full name membership signup
4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: January 27, 2014 (RSS)
By rez - January 23, 2014 - edited: January 23, 2014
I have website membership, facebook login and twitter login.
Isn't it standard to make first name and last name separate? It seem like you could sort people better, address them by first name in emails, etc.
I havent used any of these plugins or setup any type of online memberships before. Before i get into making that change to your included examples, is there anything I should know about integration or cons of separating my members names into first name and last name for website membership?
Pros and cons?
thanks.
Hi Rez,
We mainly use a single name field as opposed to first and last name because CMS Builder's admin section already has a field with that name by default, and for simplicity. I agree that breaking up the field into first name/last name has several advantages.
I've done some local testing, and deleting the fullname field and replacing it with a first name/last name field doesn't create any issues. You'll just have to update your sign up page and update profile page to use the first name/last name fields instead of the full name field, otherwise there shouldn't be any issues.
Let me know if you have any questions, or would like a hand updating the code for the signup and profile pages.
Thanks!
Greg
PHP Programmer - interactivetools.com
By rez - January 24, 2014
- I have changed to first_name and last_name.
- I made a members table instead of using the regular accounts table so I can assign admins in CMSB to manage members separately.
- I set up the Facebook login plugin.
It all seems to work fine but using the Facebook sign-up doesn't bring over / fill in the first_name, last_name in the profile. I would really like that to happen so I know members names. Can you tell me how to set that up and is there any other info I can pull from Facebook accounts?
Actually, I'll be setting up Twitter login as well so I hope I can fill in first_name, last_name with that as well?
thanks, that was fun.
Hi Rez,
To store the first and last name of a user via Facebook, you need to edit line 250 of facebookLogin.php in your plugins directory. You need to update it to look like this:
// adding available information to the new user record
// a list of available fields can be found here http://developers.facebook.com/docs/reference/login/basic-info/
$columnsToValues['email'] = $user['email'];
$columnsToValues['username'] = $user['email'];
if (array_key_exists( 'fullname', $schema )) {
$columnsToValues['fullname'] = $user['name'];
}
$columnsToValues['first_name'] => $user['first_name'];
$columnsToValues['last_name'] => $user['last_name'];
I've highlighted the new content I've added in green. The $columnsToValues are the field names for the members table. $user is an array of values returned by the facebook plugin (in this examle they just happen to have the same keys as our local fields).
So $columnsToValues is the data that will be saved against the users account when an account is created for them.
Here is a list of all of the keys returned in the facebook array: id, name, first_name, last_name ,link, hometown, location, bio, quotes, work, education, gender, email, timezone, locale, verified, updated_time, username.
It would be possible to store this data from facebook against a user as well.
Unfortunately, the twitter login system gives us a lot less information than the facebook version. It does return a users screen name, but it won't return the users e-mail address or full name. So when a user registers via the twitter plugin for the first time, we ask them to fill out a form that contains the required information for us. This form is the twitter connect form, and is generated via the CMS Builder Code Generator. You'd just need to add two new fields to the form for the users first and last name and ensure the data is saved, much like the user registration form.
Thanks!
Greg
PHP Programmer - interactivetools.com