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™

dynamically set 'required' status of registration field

s2Member Plugin. A Membership plugin for WordPress®.

dynamically set 'required' status of registration field

Postby halifaxious » September 15th, 2011, 10:51 am

I've run into what might be considered an s2member bug. To whit: when a member is demoted the information that had been in fields only applicable to higher levels seems to be lost. This means that the member must re-enter any higher level fields when they are re-promoted.

To work around this issue, I'd like to make fields that are optional for level 0 and required for levels >1 (in my case, it would be a set of address fields).

So far as I can determine, a custom registration field is either required for all the levels it applies to or optional for all the levels it applies to. I watched the video on how to dynamically set registration fields, but I can't determine which hook I should be attaching my function to or which values I need to change. Is there a reference somewhere to the structure of the $_field variable and/or other data structures I'll need to manipulate?
User avatar
halifaxious
Registered User
Registered User
 
Posts: 11
Joined: May 13, 2011

Re: dynamically set 'required' status of registration field

Postby halifaxious » September 23rd, 2011, 11:24 am

To clarify the above, I'd like to know a) if it is possible and b) how to make registration fields required for one level and optional for another level.

Thanks,
Jen
User avatar
halifaxious
Registered User
Registered User
 
Posts: 11
Joined: May 13, 2011

Re: dynamically set 'required' status of registration field

Postby Cristián Lávaque » September 24th, 2011, 10:42 pm

Thanks for finding that! I'm going to let Jason know so he can find a solution to it.
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: dynamically set 'required' status of registration field

Postby Jason Caldwell » September 27th, 2011, 8:30 pm

Thanks for your inquiry.
halifaxious wrote:To clarify the above, I'd like to know a) if it is possible and b) how to make registration fields required for one level and optional for another level.

Yes, this is possible, you just need to create two fields, each with a different ID. One will be required at Level #1, another is optional at Level #2 in the following example. Both fields ask for the same type of input and use the same label, but are configured in two different ways. ( click to enlarge )
SNAG-0008.png

If a Member is demoted, Custom Fields are not lost. However, if you (or they) edit their Profile after having been demoted, and fields which were present at the previous level no longer apply at the new demoted level, this is when the data loss will occur ( i.e. upon the data being saved again, minus the previous fields which no longer apply ). Not exactly a bug, but I see why you question this after a re-promotion. I'll see what can be done to improve this in the future.
~ 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


Return to s2Member Plugin

Who is online

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

cron