Forum is closed

3rd-Party Subscription Integration

3rd-Party Subscription Integration

Hi Guys,

I just purchased a subscription for JLinked (Great component BTW-Thank you!). I need some guidance on how to integrate it with 3rd party registration components/forms. Your standard plugins support CB and JomSocial...etc. I would like to integrate it with Akeeba Subscriptions (I noticed you've achieved this on your website), and also I would like to integrate it with Breezing Forms (From Crosstec). Could you direct me please on how to achieve this.

Much appreciated.

Tim

Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Tim,
Integration is a wide open question, so I'll try to answer, but you can follow up with any other questions you may have. Our social profile plugins are used to actually import the user's LinkedIn profile data into the 3rd party extensions.

At it's simplest though, you may just want to add the "Login with LinkedIn" button to other forms, like we've done with AkeebaSubs on this site. We *don't* import any profile data into AkeebaSubs, we just show the login button on those pages for easier access.

If the Login button is all you're looking for, you can create template overrides for any of the AkeebaSubs or BreezingForms files that you want and then add our login button with the following code:

Code:

<a href="javascript:void(0)" onclick="jlinked.login.login();">

   <img src="/mod_sclogin/images/button_linkedin.png">
</a>

You can use other login button images if you want, or even a text link, but the above will use the SCLogin's LinkedIn blue button.

I hope that helps get you started, but if you have more information on what 'integration' you're looking for, we'll gladly help you do it however we can.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
24163 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Hi Alex,

My apologies, I should've clarified my question. I actually meant importing a user's LinkedIn profile. I have two projects that require JLinked:

One service uses Akeeba Subscriptions, where user details need to be imported into it automatically, as it does with Joomla's registration process or Jomsocial...etc.

The second project uses BreezingForm's Joomla's registration replacement app, again to import user details from LinkedIn. Also, since is it a form building component, it will be used to build additional surveys, questionnaires...etc. It would be really helpful to use JLinked with these as well.

The challenge with both projects above is to be able produce custom fields that correspond to Linkedin's profile fields, like a users title, short description...etc.

So we need some guidance, just to understand how to implement the above.

I hope this clarifies what we are trying to achieve. I'm happy to answer any further questions.

Many thanks,

Tim

Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Tim,
To import that information, you'd need to create a new Social Profile plugin. It's likely we'll create one for AkeebaSubs later this year, but it won't be for at least a few weeks, and likely not for a few months.

The process for creating a social profile plugin is pretty straight-forward. If you don't need avatars, it's even simpler. I'd start by looking at the Kunena social profile plugin, as it's a good, simple, example. Basically, you need to do the following:
* Update the "getProfileFields" function which will show the fields in the mapping section of the profiles area.
* Update the saveProfile function to properly save the data imported from your mappings in the profiles area.
* You can use the createUser function if you have to do something special when the user registers, like creating them in a special table.

Obviously, it'd be best to have a developer implement this stuff, but the profile plugins are generally less than 100 lines of code. If you run into issues and have questions though, just let us know.

I hope that helps,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
24163 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Thanks Alex,

Yes we are developers, so we are happy to do some 'dirty' work.

This sounds great. I will update you if there are any issues.

One thing that we forgot is that Akeeba Subs automatically integrates with Joomla's com_users. So, unless you need to create custom fields, JLinked can be used to import data into Joomla (in the background), then just simply allow Akeeba subs to automatically import them. It's somewhat of a convoluted approach but it works if people can't/don't want to mess around with the code.

All the best,

Tim

Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Tim,
Glad that helped spawn some ideas. For Akeebasubs importing data from Joomla, that's definitely true. However, if you want to automatically import information like City and State, that's something you'd need a plugin for since Joomla doesn't have anywhere to store that data.

One other thing I forgot to mention is that the profile plugins are good for getting data during registration or login. There are other ways to dynamically get profile data while the user is perusing your site. For instance, with a contact form, you may not want to fetch the user's City during registration, but if they try to contact you, you can get it during that page load and pre-fill it for them. If you are interested in that, it's just a few lines of code to get that data, but of course you'll have to do something with it in the other extensions.

Either way, best of luck and let us know what you come up with.

Thanks,
Aelx

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
24163 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Hi Alex,

We can't seem to find the Kunena Social Plugin. It was not included in the package we downloaded. It only has JomSocial, CB and K2. Have I missed something during the download process?

Best,

Tim

Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Tim,
My guess is that you downloaded the Joomla 3.x package which didn't have all of the profile plugins included. The Kunena plugin was left out because we hadn't fully tested that plugin with Joomla 3.0 yet. There's no 3.x version of the plugin available yet, but the 2.5 is the exact same except for some minor differences in the XML file.

You can easily download the 2.5 version, or any of the other social profile plugins, from the link below though:
http://www.sourcecoast.com/index.php?op … e&id=6

I hope that helps, but if you have any questions, let me know.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
24163 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Hi Tim @timbms,

Did you manage to achieve this yet?

I'm working on a set of plugins - specifically a user plugin, an akeebasubs 'timed groups' plugin to auto upgrade a users group at set intervals during the life of a subscription and system plugin - that I will be adding the auto-population of data from facebook to the subs page. BTW, I know that its JLinked that you're trying to integrate with but, from the akeeba subs side of things, the principles will be the same.

In preparation for performing this data pull, I've discovered that in order to get this to work in akeebasubs, I will have to override the AkeebasubsControllerLevels::onBeforeRead method. Since this is a core method in the controller, any modification of this will need to be re-done at each Akeeba Subs upgrade. I am therefore looking into how I might overload this method in a system plugin.

I haven't started the FB integration part yet so, I'll post an update if and when I manage it. In the meantime, I'd be very interested to see any of your findings! current/wink

Best of luck,

Gez

Edited by: learnthrusong - Jun-27-13 10:35:02
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

OK, I've made some headway with this...

First, to further explain why the AkeebasubsControllerLevels::onBeforeRead needs to be overridden: this is because this controller is the only place in which the AkeebaSubs $view->cache can be overridden.

So, what I've done so far is:

  1. Created a System Plugin with a __construct & onAfterRoute methods

  2. In the constructor I validate the existence of the AkeebasubsControllerLevels with a file_exists on it's path

  3. Created an 'overrides' dir in my system plugin with a 'clone' of the AkeebasubsControllerLevels class

  4. Renamed my 'clone' of AkeebasubsControllerLevels file and class MyclassnameController extends AkeebasubsControllerLevels (not FOF)

  5. Removed all methods from the methods from MyclassnameController other than the one I want to override (onBeforeRead)

  6. In my system plugin, using JApplication class, I detect when I'm option == com_akeebasubs and view == levels

  7. If true, require_once on the original controller then the overriden one in the 'overrides' directory like:

    Code:

    require_once($originalControllerPath);
    
    require_once($overrideControllerPath);


  8. instance a new controller like

    Code:

    $controller = new MyclassnameController();


  9. Call onBeforeRead from overridden controller like

    Code:

    $controller->onBeforeRead();


  10. To verify your calling the overridden onBeforeRead, echo something or dump/print something from the method and you'll see, you have completed the first step! current/wink
Now that stage 1 is complete, overriding the $view->cache for fields I want to fetch from facebook should be a sinch.

I'll post an update if I get chance to do this over the weekend!

Hope it helps someone!

Best of luck,

Gez

Edited by: learnthrusong - Jun-28-13 12:16:54
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

learnthrusong,
Sorry for the (very) delayed response on this and thanks for providing the solution you're working with. If you already have the overrides in Akeeba how you want, but haven't made it to the fetching of user profile data, I can help with that. It should be quite simple, actually.

The following code lets you instantiate our profile library and then fetch data from Facebook about the user:

Code:

$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();

$fbUserId = $jfbcLibrary->getFbUserId(); // Get the Facebook ID of the user
$profileLibrary = JFBConnectProfileLibrary::getInstance();
$profile = $profileLibrary->fetchProfile($fbUserId, array(0 => 'first_name', 1 => 'last_name'));

$firstName = $profile->get('first_name'); // this gets the first name of the user.

Once you have that $profile variable, you can use the data to populate stuff however you want. You can look at the /components/com_jfbconnect/libraries/profile.php file for a list of fields, though there are actually more that Facebook supports.

I hope that helps and thanks again for sharing.

Tim,
If you're still needing help in pulling in the profile, let us know. I know you mention that you found a good roundabout way to do it, which I think should work just fine as well. If you need anything though, that's what we're here for.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
24163 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

Hi Alex,

Brilliant - thanks...

I have an update to post regarding this which drastically changes the approach due to akeeba's Framework on Framework (FOF) having provided hooks into the controllers. I will update the post asap to reflect this change.

Thanks again,

Gez

Administrator has disabled public posting. Please login or register in order to proceed.

Re: 3rd-Party Subscription Integration

OK Guys, after some experimentation with the method described in my post above (34095), it was not 'the' answer.

After opening up a discussion with Nicholas over at akeeba about alternative ways of being able to 'inject' the facebook data from JFBC (same for jLinked), it transpired that there was only 1 viable option: extending FoF to include some plugin hooks. Very quickly, said 'hooks' have been added.

You can access this FoF functionality by

  1. Downloading & installing the latest" target="_blank" >http://www.akeebabackup.com/download/de … dev]latest dev release

  2. Create a system plugin

  3. Create the following method: ** UPDATED **

    Code:


    public function onBeforeAkeebasubsControllerLevelRead(FOFController &$controller, FOFInput &$input)
    {
           // instance JFBC class
           $jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
           $fbUserId = $jfbcLibrary->getFbUserId(); // Get the Facebook ID of the user
           $profileLibrary = JFBConnectProfileLibrary::getInstance();
           $profile = $profileLibrary->fetchProfile($fbUserId, array(0 => 'first_name', 1 => 'last_name', 2 => 'name',  3 => 'email'));

            // Get the akeebasubs view object
            $view = $controller->getThisView();
           // print_r($view); // to see the elements/properties ($view->cache is what you'll be most interested in)

            // array to push facebook data into
            $cache = array();

            $cache['email'] = $profile->get('email'); // where $profile is your FB profile object
            /* ... any other FB data here ... */
            $cache['name'] = $profile->get('name');

            // Overwrite the elements of $view->cache (that you want to populate with FB data - E.G. in a loop
            $overwriteKeys = array_keys($cache); // the array keys we'll want to overwrite in the $view->cache
            foreach($view->cache as $k => $v){
                 // if the key ($k)  is one that we're populating with data from FB
                 if(in_array($k, $overwriteKeys)){
                      // set the matched element within $view->cache to the data from $cache array
                      $view->cache[$k] = $cache[$k];  // E.G. $view->cache['email'] = $cache['email'];
                 } //end if
            }//end foreach
    }


  4. Done current/wink ** END UPDATE **

Hope it helps!

Gez

Edited by: learnthrusong - Jul-19-13 04:20:48
Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests also viewing this topic
There are 0 users also viewing this topic

Board Info

Board Stats
 
Total Topics:
11697
Total Polls:
0
Total Posts:
49100
Posts today:
2
User Info
 
Total Users:
47895
Newest User:
dropofffat51
Members Online:
0
Guests Online:
986

Online: 
There are no members online
Social Stream
SourceCoast Joomla Social Extensions
Friday, 25 May 2018
JFBConnect 8.0 Coming Soon! Stay tuned.
Refer and Earn

Like our extensions? You're not alone! That's why they're used on tens of thousands of websites. Now you can earn 20% of any sale you refer to SourceCoast.com.

We provide excellent documentation, well laid out sales pages and great support. All you need to do is spread the word and we'll take care of the rest.

Learn About Our Affiliate Program