Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] separate registration procedure

  • Ntelos
  • Ntelos
  • OFFLINE
  • Posts: 95
  • Thanks: 4
  • Karma: 0
11 years 3 months ago - 11 years 2 months ago #234164 by Ntelos
Hello there.

Can I somehow do this:

Separate the registration procedure, so I will have 4 basic fields shown in a module (with wrapper usage) and then when the user clicks register to go to the next page to complete the other registration data?

So, is there a way to do such a thing or do I have to do it manually?

Thank you in advance
Last edit: 11 years 2 months ago by krileon.

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

  • Ntelos
  • Ntelos
  • OFFLINE
  • Posts: 95
  • Thanks: 4
  • Karma: 0
11 years 3 months ago #234193 by Ntelos
Replied by Ntelos on topic separate registration procedure
Actually i found a component with which you design joomla forms and you can use javascript and/or php code.
So , if i have a field inside the created form called audio, then with the next code, i can update the cb field called cb_audio1 with the value that i will type in my form's field called audio.
Code:
$db =& JFactory::getDBO(); $user =& JFactory::getUser(); $uid = $user->id; $db->setQuery("UPDATE #__comprofiler SET cb_audio1 = '".$_POST['form']['audio']."' WHERE user_id = '".$uid."'"); $db->query();

So, what i need to know do is this:

Create 2 simple registration forms.
1st registration form: Will have 4 fields, and when i click register then with a code similar with the example above, will create a new user passing the values i type in the form to the new user through SQL query.

2nd registration form: I will have only 2 fields (i.e. e-mail and password) and when user clicks to register, then he/she goes to the cb registration form, but the e-mail and the password will have to pass from the previous form, so the user can continue with the registration at the cb registration form. (I do this in order to have a quick register in frontpage and not lose possible users).

Are those 2 scenarios possible? I know that the first one, if possible can be done with a SQL query like the one in the example. But, if the 2nd scenario would be possible, i would like a code hint in order to make it operate.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
11 years 3 months ago #234203 by krileon
Replied by krileon on topic separate registration procedure
Do not insert and do not update CB user rows using SQL. It absolutely has to be done through API. Using queries will not fire CB triggers and will cause any usage that depends on said triggers to fail. Example API usage as follows.

Code:
$user = CBuser::getMyUserDataInstance(); $user->storeDatabaseValue( 'cb_audio1', $_POST['form']['audio'] );

The above usage allows you to store a single column value while also firing triggers. If you need to store more you need to fire the profile update triggers manually before and after store().

Configure your HTML form to be a GET instead of a POST. Next using CB Auto Actions on the registration form display trigger with a Code action and Method set to jQuery. Now just set the fields values using jQuery from the GET values. Example as follows.

Code:
$( '#username' ).val( '[get_username]' );


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.
The following user(s) said Thank You: Ntelos

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

  • Ntelos
  • Ntelos
  • OFFLINE
  • Posts: 95
  • Thanks: 4
  • Karma: 0
11 years 3 months ago #234273 by Ntelos
Replied by Ntelos on topic separate registration procedure
Thank you for your help. I need to ask this though:

1. Can i have 2 fields e-mail and e-mail confirmation and pass those values to the cb_fields of cb registration page?

2. The same with the password value.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
11 years 3 months ago #234275 by krileon
Replied by krileon on topic separate registration procedure

1. Can i have 2 fields e-mail and e-mail confirmation and pass those values to the cb_fields of cb registration page?

Yes, it's just jQuery so you can do whatever you like. You use [get_VARIABLE] to get variables from your URL. Please see my previous reply for an example usage.

2. The same with the password value.

Yes.


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.

  • Ntelos
  • Ntelos
  • OFFLINE
  • Posts: 95
  • Thanks: 4
  • Karma: 0
11 years 3 months ago #234378 by Ntelos
Replied by Ntelos on topic separate registration procedure
Ok, let me conclude all the facts.

The example i posted at first place was from the component form that updates a cb field.

I have a form from this component that i need to create new user and pass values from form to the new user.

So, your suggestion not to use SQL but API, like this:
Code:
$user = CBuser::getMyUserDataInstance(); $user->storeDatabaseValue( 'cb_audio1', $_POST['form']['audio'] );

After this, you write something about GET instead of POST etc, but i got confused by reading that paragraph. Can you please explain this to me?

Finally, lets assume that i have a form with 3 fields: name, e-mail and password. So, by clicking on register button, i need to execute a php script that creates new user, passes the values from name, e-mail and password to cb_name, cb_email and cb_password fields and also triggers a CB Auto Action that assigns a user to a group and a cb subs plan.

So the main idea of the code is something like this, correct?
Code:
$db =& JFactory::getDBO(); $user = CBuser::getMyUserDataInstance(); $uid = $user->id; $user->storeDatabaseValue( 'cb_name', $_POST['form']['name'] ); $user->storeDatabaseValue( 'cb_email', $_POST['form']['e-mail'] ); $user->storeDatabaseValue( 'cb_password', $_POST['form']['password'] ); WHERE user_id = '".$uid."'

Or i need something else to get this work?

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

Moderators: beatnantkrileon
Powered by Kunena Forum