Jomsocial - How to add an extra field on the first page of Jomoscial registration
I am struggling to do a hack in the default Jomsocial Registration.Problem is that, if you see the default jomsocial registration page it has all the fields that are there in default core joomla registration page.i.e Name,Username,E-mail,Password,Verify Password.
But I want to add an extra-field on this jomsocial page.Right now if i add a extra field using custom profile then user has to click next and go to next page which is long process and giving high bounce rate on my u开发者_如何学Pythonser registration.
So can you please advice me on the same and one more thing is it like if say we add a field in Joomla default registration page it will automatically come to jomsocial first page..
Will be thankful,if someone can help me to solve this problem.
You can add custom registration field on the first page by following the process (works with joomla 2.5) :
Step 1 : You have to add the field so that it appears on the first page (front end), for that go to components\com_community\templates\default\register.index.php
Now just add the field as other fields are there, for example(FIELD is taken as field name to be added)
See example here : Click Here!
you may copy and paste other field details and then edit for your own, the label tag shows how the label will appear at the front end, the input field shows the input field, you can adjust the size, but should not change the id, name (as would be required while collecting the data) and the value (other then replacing the previous field name with the new field name where ever it appears!), class can be edited as required, like removing 'required' will make the field optional to be filled, validate-FIELD is used if you want to validate the field using some script for the values entered, span is for displaying the error msg... now when you have added the field so that it appears in front page, you will have to do some work so that the data is actually taken to the database when the form is submitted! So we go for ---
Step 2 : when the form is submitted, the data is not stored in prefix_users table, but an object is created which stores the temporary information and then it is stored in com_community\models\register.php , now to change the object and add one more field so that the object contains the value of our field also, we have to add one line in it, you will see code like
$obj = new stdClass(); $obj->name = $data['jsname']; $obj->firstname = isset( $data['jsfirstname'] ) ? $data['jsfirstname'] : ''; $obj->lastname = isset( $data['jslastname'] ) ? $data['jslastname'] : ''; $obj->token = $token; $obj->username = $data['jsusername']; $obj->FIELD = $data['jsFIELD']; $obj->email = $data['jsemail']; $obj->password = $data['jspassword']; $obj->created = $nowDate; $obj->ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
in the above code, in the 7th line i have added my field so that the object also stores our field when the form is submitted, now we must add one field in the table where this object is actually stored for a moment, that table is prefix_community_register
The table is like -
1 id int(10) 2 token varchar(200) 3 name varchar(255) 4 firstname varchar(180) 5 lastname varchar(180) 6 username varchar(150) 7 email varchar(100) 8 password varchar(100) 9 created datetime 10 ip varchar(25) 11 FIELD int(11)
11th field of the table is the field we are adding, it must be of same name as field inside the object (eg. if the object has $obj->age , the name of the field in table must be 'age' too!), so now finally we need to store the same data permanently in the prefix_users table, so create a field in the table with the same name and attributes, when the registration is complete, the value will be stored in the users table too, then you can use that field where ever you want ;)
Go to Administrator--> component --> Jom social--> Custom profile --> New Field .
Here you can easily add your New field..!!
I think it will be help you..!!
I actually use Jom Social and Joomla. I have used them for quite sometime and here is the link to the answer to this question.
I am not sure if it has changed in 3.0 JomSocial but this should help. Jomsocial Custom Profile - Display email used on first page of registration onto the second page of registration
Also keep in mind you can always create your own registration page and then allow users to fill in the secondary profile information from their edit profile page. Just redirect to edit-profile once logged in.
A good component to use to build custom forms and such is http://fabrikar.com.
Hope this information helps
精彩评论