Topic-icon Community Builder API

Active Subscriptions:

None
14 years 3 months ago #19087 by simcro
Community Builder API was created by simcro
I have a plugin (specfic for an application I run) for community builder which in essence syncs the user with my other application/database. My question is, does sign in through JFB Connect trigger the CB api for registration or does it write directly to the CB tables in the database. Probably a cheeky question but it will save me lots of time wading through code to get an answer :)
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19093 by simcro
Replied by simcro on topic Community Builder API
I found this post regarding using CB Login framework instead of the regular Joomla login:
www.sourcecoast.com/forums/jfbconnect/jf...b-login-email-layout
I wondered if it is possible to suggest a similar code change to use the CB registration as well so that it can trigger the CB plugin I am using to sync users with my other app
The topic has been locked.
Support Specialist
14 years 3 months ago #19122 by alzander
Replied by alzander on topic Community Builder API
Simon,
The post you refer to, for logging a Joomla (non-Facebook) user in with the SCLogin module, that will respect the different CB settings for username type. We get a lot of feedback from users and are always trying to improve our integration where we may lack.

As for your specific question, we do use CB's API when saving the user. However, JFBConnect first creates the Joomla user in the standard way. Then, we call the CB function "saveSafely" with a parameter of 'edit'. This is because the user has already been created (even if it was just moments before) and isn't a real registration. The 'edit' process does trigger different CB events like "onBeforeUserUpdate" and "onAfterUserUpdate", but it does not trigger the "onBeforeRegistration" event.

For JFBConnect/Facebook functionality, we more or less have to do it this way due to processes that we need for proper integration with Facebook (the Joomla user creation processes which are shared for a lot of different functionality) and limitations in CB's registration process (which is very rigid and is not welcoming to other extensions trying to use it).

Hopefully, you can switch your plugin to use the other trigger events within CB mentioned above. We can also help you with some code that could actually tell you if it's a JFBConnect registration that's actually occurring, if that would help. Otherwise, you could also move to using a Joomla User plugin which would definitely work with the JFBConnect registration process. It would also work with any other registration process because it's the standard way to do things.. which isn't what CB does. Not that that would help you necessarily.

Anyways, hope that helps explain, but if you have other questions, just let us know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19155 by simcro
Replied by simcro on topic Community Builder API
I have just tried a test and it appears that registration using JFB Connect does not trigger either onBeforeUserUpdate or onAfterUserUpdate. Basically I set my CB Plugin to return an error on those two triggers just to test and neither reponded. What am I missing?

I am using joomla 2.5 and the 4.1.2 version of JFB Connect.
The topic has been locked.
Support Specialist
14 years 3 months ago #19213 by alzander
Replied by alzander on topic Community Builder API
Simon,
We're looking into why those triggers aren't being called. In 3 years, we've never had a user mention that those are causing problems.. either because they haven't been necessary, or because it's been working.

I'm looking at the code right now for CB (the //administrator/components/com_comprofiler/library/cb/cb.tables.php), and in the saveSafely function, we call with a $reason of "edit" and a $ui of "1". With that combination, botht he onBeforeUserUpdate and onAfterUserUpdate triggers should be called.

This is with v1.7 of CB (though the code was initially developed on CB 1.2, so any version between there should work). What version are you using?

We'll have to do some more debugging to see if those triggers are really being called, but I'll admit, CB can be very difficult to track down what is happening vs what should be happening sometimes....

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19216 by simcro
Replied by simcro on topic Community Builder API
Using Joomla version 2.5 and CB version 1.7.1. My CB plugin is working on all other triggers. I agree with your assessment of CB and bug tracking !
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19331 by simcro
Replied by simcro on topic Community Builder API
Any news on triggering the CB Events?
The topic has been locked.
Support Specialist
14 years 3 months ago #19363 by alzander
Replied by alzander on topic Community Builder API
We're still doing some testing. We honestly don't have any plugins that use the onYYYSaveUser triggers, but we have stepped through the code during execution and have seen that trigger called.

Is the plugin you're using publicly available, or is it something that was created just for your site? We'd like to test with something if possible.. and I really don't know the plugin structure of CB well enough.

Not to make you go and do all the work again, but have you ever looked into using Joomla's User plugins? They are definitely triggered by JFBConnect and are much more widely supported by other extensions as well.

We'll keep you posted on what we find, but (again) if you have any user registration plugin recommendations, they could help a bit.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19383 by simcro
Replied by simcro on topic Community Builder API
OK here are some further thoughts:
I noticed that registration by facebook was creating a user which had not been approved or email authenticated despite having "skip Joomla Activation" set to "yes".
I figured that errors were interrupting the registration process so removed all the mapping to CB Custom fields and hey presto registration now works as intended. Users are saved approved and email authenticated.
So then I enable my plugin for the CB API. Guess what...Users saved not approved and without email authentication.
I figure that my API is being called, throwing an error (thats the way I have set it to test) but JFB Connect somehow traps the error and continues with the incomplete process.
If that s the case how do I test and debug my script for facebook registratons??
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #19391 by simcro
Replied by simcro on topic Community Builder API
I have established that a facebook regstration does in fact fire the CB onbeforeUserupdate event. What I don't know, and can't find out, is whether the user password is included in the object. Updating through CB only includes the password if it is changed, but I need it to register the user in the other DB. I have a futher question as well. Does a login by facebook through JFB Connect trigger a login event in CB or only through Joomla?
I would also like to know what code you could provide to identify a JFB Connect registration in the CB Onbeforeuserupdate event. That would be extremely useful.
The topic has been locked.