Trigger a community builder user subscription/sign-in with a script

11 months 2 weeks ago - 11 months 2 weeks ago #333522 by huguesmarcil
Hello,
I am trying create a form with a script to allow a user to sign-in to my website. I use community builder as user registration tool. In Joomla! 3 I managed to do this by calling a CB function
activateUser()
and
$_PLUGINS->trigger('onBeforeUserRegistration', array(&$user, &$user));
and
$_PLUGINS->trigger('onAfterUserRegistration', array(&$user, &$user, true));
.

But now I am using Joomla! 4 it is not working anymore. The activation code is not sent to the database. So user cannot activate its account. But they receive the confirmation email (with activation code that does not work)
Thank you

Hugues

Please Log in to join the conversation.

11 months 2 weeks ago #333529 by krileon
Be sure you've set their user object as block = 1 and confirmed = 0 before calling activateUser. That function is unchanged and is not dependent on Joomla version.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

11 months 1 week ago - 11 months 1 week ago #333598 by huguesmarcil
Hello Krileon,

Thank you for you reply!

I used the API described at: www.joomlapolis.com/support/tutorials/120-api-usage/18362-registering-a-user-through-cb-api
And I did not changed the code, so I guess it should have worked.

"block" and "confirmed" depends on this two lines. But I do not know to what " $ueConfig" refers to
$approval = ($approve == 2 ? $ueConfig['reg_admin_approval'] : $approve);
$confirmation = ($confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm);

And I call "registerUser()" with these parameters:
registerUser(ff_getSubmit('cb_firstname') , ff_getSubmit('cb_username') , ff_getSubmit('email') , ff_getSubmit('cb_username') , ff_getSubmit('password'), 0, 2);

If the parameter "confirm" is set to "0" in the funtion calling, then we are automatically registered and user is activated. But the activation code is not send to the "users" table in the database.

We have been looking into this problem for several weeks, but unfortunately we have not found any clues.
We use CB 2.8.0.

What would you suggest?
Thank you
 

Please Log in to join the conversation.

11 months 1 week ago #333603 by krileon
$ueConfig is a global variable and is the CB configuration array. It's a lot easier registering user through CB Auto Actions though as it extracts away all this logic and mimics a CB registration safely.

My guess is there's a problem with your code somewhere. Enable debug mode and maximum error reporting to see if any errors output during a test registration through your API usage. Also check that the user is blocked and unconfirmed in CB > User Management to be sure they're in the correct state to receive confirmation emails.

You're also setting approval to 0 and confirm to 2 in your API call. Try setting confirm to 1 to force confirmation on instead of being dependent on CB configuration, because if you don't have confirmation enabled in CB > Configuration > Registration then it won't require them to confirm.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

11 months 4 days ago - 11 months 4 days ago #333672 by huguesmarcil
Hello,

Thank you for your reply!

Are you sure that there is a problem with the code? Because when we had Joomla! 3.x it worked.
We tried to enable debug mode, but nothing related to CB appears in the logs directory in the FTP.

Users are unconfirmed and approved. Where can I see if they are blocked?

If we put 1 in the API call users will automatically been registered, that we do not want :)
CB > Configuration > Registration is enabled.

We are going to look at CB Auto Actions at the same time to see if it can resolve our problems.
How are we suppose to use it in order to register a user with an API call? Do you have some topic link where it is explained?
Thank you
 

Please Log in to join the conversation.

11 months 4 days ago - 11 months 4 days ago #333676 by krileon

Are you sure that there is a problem with the code? Because when we had Joomla! 3.x it worked.

You completely changed major CMS versions. There's no telling what may or may not work correctly. It's a relatively smooth upgrade, but you can't discount the fact that it is a major one. The example code should still be completely functional. It's possible a Joomla plugin is messing with the registration though as this will fire Joomla registration events so Joomla user and system plugins will act on that registration.

Users are unconfirmed and approved. Where can I see if they are blocked?

Check the Enabled column in CB > User Management. A user pending confirmation should have a row that looks like the following.

 

Is there a reason you're needing to completely bypass CBs normal registration process? Maintaining your own is additional maintenance that you'll constantly have to keep up with. We do not, and have no plans to, notify of API changes which could happen at any time breaking your implementation.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Attachments:

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.344 seconds

Facebook Twitter LinkedIn