PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

First Name field being populated (s2Member?)

s2Member Plugin. A Membership plugin for WordPress®.

First Name field being populated (s2Member?)

Postby PseudoNyhm » July 8th, 2011, 10:40 am

I have turned off First/Last name collection on my registration form. However, upon user registration, their First Name field is populated with their login username. This is not appropriate in my situation. The First Name field should be left empty.

I've confirmed that this name is, indeed, set into the database wp_usermeta first_name record upon registration. WordPress itself does not copy the username to the First Name field. Is this a behavior of s2Member?
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011

Re: First Name field being populated (s2Member?)

Postby Cristián Lávaque » July 8th, 2011, 12:46 pm

Thanks for bringing that up.

If I remember correctly, WordPress required the name field to be populated too, so when Jason added the feature to remove the First and Last names requirement, he used the username value to populate the first name.

I just deactivated s2Member in my test installation and tried registering a new account and WordPress only asked for username and email address. They either didn't require it before either and I was under the wrong impression, or they just removed the requirement with the latest release or so.

I'll show this to Jason so he can improve the feature. Thanks!
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: First Name field being populated (s2Member?)

Postby PseudoNyhm » July 8th, 2011, 1:15 pm

Many thanks for taking the time to test this out yourself. I look forward to the fix. Here's the background on the issue:

This is related to my research into Register Plus Redux. To prevent pending (not yet verified) accounts from being able to login, RpR populates the username with a temporary random string (username_XXXXXX). Upon verification, RpR returns the username to that selected by the user. Unfortunately, s2Member has populated the First Name with this ugly string, which sticks forever. It is then possible for other components to reference this, thinking it's a valid First Name.
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011

Re: First Name field being populated (s2Member?)

Postby Jason Caldwell » July 8th, 2011, 5:00 pm

There are some new options in the latest release of s2Member v110708 which allow you to control the behavior of the "Display Name". Please let me know if this helps you out. You'll find these options in your Dashboard, under: s2Member -> General Options -> Custom Registration Fields. Also, I replied to a related issue about Register Plus Redux here: viewtopic.php?f=4&t=10400&p=22551#p22686
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: First Name field being populated (s2Member?)

Postby PseudoNyhm » July 8th, 2011, 7:53 pm

Thanks for the heads-up on today's new version. I've installed it, but the First Name behavior remains.

I've configured Set "Display Name" during Registration? as No (leave Display Name at default WordPress value).

Notice that the Display Name drop-down in the admin user settings is not specifically the issue. The crux of the issue is that something is populating the First Name field with the username upon registration.

If you'd like me to test a patch, just let me know what code to edit, and I'll report how it behaves. I'm not afraid to get my hands dirty. Thanks for helping me with this.
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011

Re: First Name field being populated (s2Member?)

Postby Jason Caldwell » July 8th, 2011, 9:13 pm

Ah, I see what you mean now.

Yes, if/when s2Member is configured NOT to require a First/Last Name, s2Member will default the First Name to the Username that is selected by the User during registration. This way other routines and Replacement Codes that reference the User's First Name and Display Name will not get just an empty string. If you'd like to test other methods of handling this, you can run a search for all instances of:
Code: Select all
eval ('$fname = trim ($login); $lname = "";'); 

Inside: /s2member/includes/classes/registrations.inc.php
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: First Name field being populated (s2Member?)

Postby PseudoNyhm » July 9th, 2011, 1:11 pm

Thank you for the pointer. I will take a look under the hood.

In your experience, would leaving First Name blank trip up a lot of behavior? Do you know whether lots of other features expect First Name explicitly? Notice that requesting Display Name will still work, because that will return the username.

Instead of altering s2Member, is there a way for me to add something to clear the First Name field after s2Member sets it (some sort of post-registration hook)? I'm not very familiar with WordPress integration (yet), so your input would be most helpful (... before I go breaking things).
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011

Re: First Name field being populated (s2Member?)

Postby PseudoNyhm » July 9th, 2011, 3:33 pm

Success!

As suggested, I edited /s2member/includes/classes/registrations.inc.php and commented out the three occurrences of the following block:

Code: Select all
//if (!$fname) /* Default to Username? */
//      if ($login) /* Username and empty Last Name. */
//              eval ('$fname = trim ($login); $lname = "";');
 


Upon registration, no First Name is set. The display name is correctly set in the user admin panel (to the only possible option, which is their username). This holds through the verification phase (using Register Plus Redux plugin). The user was even able to purchase a subscription via PayPal, and s2Member handled everything fine.

These edits won't survive an update, of course. As an enhancement to a future version of s2Member, may I request a General Option to choose the desired behavior (if not collecting First/Last Name)? Thanks again for your assistance.
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011

Re: First Name field being populated (s2Member?)

Postby Jason Caldwell » July 9th, 2011, 4:00 pm

These edits won't survive an update, of course. As an enhancement to a future version of s2Member, may I request a General Option to choose the desired behavior (if not collecting First/Last Name)? Thanks again for your assistance.

Absolutely. Thanks for reporting back on this.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: First Name field being populated (s2Member?)

Postby Jason Caldwell » August 18th, 2011, 8:58 pm

This behavior was updated in the latest release.
If/when no names are being collected ( based on your configuration ), the First/Last Name fields remain empty, as they should be.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: First Name field being populated (s2Member?)

Postby PseudoNyhm » August 18th, 2011, 10:24 pm

I noticed this, and did a test registration. Worked perfect. My thanks.
User avatar
PseudoNyhm
Experienced User
Experienced User
 
Posts: 79
Joined: June 19, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 0 guests

cron