Add fields in registration process
What should I do, when I want to ask additional details from users, at the time of registration?
If I'm using Payplans-Quick Registration or One-Click Checkout, then firstly, I need to create backup of existing Quick Registration plugin.
Step 1: Go to root/plugins/payplansregistration and copy the folder “auto” and save it with other name.
Step 2: Now, let’s say I want to add, an new field “First Name” to the registration.
Step 3: Goto the file at following path
Step 4: Add the following HTML code to it as follows :
<div class="control-group"> <div class="control-label"> First Name </div> <div class="controls"> <input type="text" size="20" id="payplansuserfirstname" name="payplansuserfirstname" class="placeholder" /> </div> </div>
Step 5: We have added only, html code, now we need to save it’s user params.
Step 6: Go-to the file at following path
Step 7: Find for the function “_doStartRegistration” and add this following code just after this lines of code.
$userId = $this->_autoRegister($username, $email, $password);
Code to be added:
//get the new value $newValue =JFactory::getApplication()->input->get('payplansuserfirstname', ‘’); $user = PayplansUser::getInstance($userId); //save this new field value to user’s params, you can name it as you wish $user->setParam(‘firstname’, $newValue); $user->save();
Step 8: It’s done, I can use this value as an payplans token also. it will not show in the list “view token” of payplans but can use following token to access this value. (camel-case word of the params that you have save).
for above eg. <<USER_PARAMS_FIRSTNAME>>
These change will be disapeared on payplans upgrade, so you need to have an backup for that.