Skip to Content Skip to Menu

CB AutoActions: trigger to execute query before user registration saved

  • ani333
  • ani333
  • OFFLINE
  • Posts: 10
  • Thanks: 0
  • Karma: 0
1 year 2 days ago - 1 year 2 days ago #335455 by ani333
Hello

We have users who register with a temporary membership. Later they can decide to register as a full member. So when they register as full member there maybe exists already a user profile in Joomla and CB with probably the same email and username (because we use email as username).
The temporary membership is more a technical one and these users don't know that they are "temporary members". That's why we don't want to update the profile but rahter to create a new one for full membership.
So what I want to do is change username and email of the "old" user profile before CB makes the registration.

I made an auto action type query and tried various triggers.

 

The query sets a new username, email and password to the user already saved with the same email like entered on registration form (CB_PRIVATE_EMAIL).

 

Result:
The query is executed, but the insert of the new user results in an error: username already in use (UE_USERNAME_NOT_AVAILABLE).

Joomla 4.4.0
Community Builder 2.8.1

Am I maybe wrong with the triggers I chose / which one would be appropriate?
Is it possible to make changes in the database before CB checks if there is already a user registered?

Thank you and regards,
Anita
Last edit: 1 year 2 days ago by ani333.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 1 day ago #335463 by krileon
onStartSaveUserRegistration should be early enough to do that. The other 2 triggers won't be early enough. The problem will be your substitution [cb_private_email] won't work on onStartSaveUserRegistration as the user object isn't built yet. You'll need to access the POST data of the registration form directly. Try using [post_cb_private_email] assuming that field is available during registration.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum