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™

Member Profile Modification - edit one field only

s2Member Plugin. A Membership plugin for WordPress®.

Member Profile Modification - edit one field only

Postby toddz88 » May 12th, 2011, 3:29 am

I want to do a special version of the Member Profile Modification form, where a member can see and edit ONE particular field ONLY -- one of my Custom Registration Fields (a "User Agreement" checkbox).

Some of my members will have logins they did not get by using the payment form, where paying customers had to click a checkbox to indicate acceptance of the User Agreement.

When any user logs in, I am checking to see if his (s2m custom reg field) User_Agreement == 1. If yes, he goes on to the Login Welcome Page. If NO, he is redirected to a "User Agreement" page where he can read and accept the User Agreement, before being allowed to see the site content.

I need this User Agreement page to show that checkbox, enabled but unchecked, so the member can click it. And then of course a submit button to save the input and update that value in the user's profile in the database.

To figure this out, I tried figuring out the hooks in s2member/profile.inc.php, perhaps to use CSS to hide (display:none) all < tr > in the Profile Modification < table > and then unhide just the row I need (with my custom field in it), but couldn't figure out how to target just that row, or its contents. Also couldn't figure out how to use hooks to hide the other rows with php instead of css.

Any ideas how to approach this -- to allow a member to see and edit one custom reg field?

Otherwise, maybe I use a non-s2m field for this.. use a wp custom user field, which might be easier to accomplish this with. But then my paying members would not click to accept the User Agreement during payment, but rather upon initial login, along with these non-paying members.

Has anyone dealt with anything like this before? Thanks for any insights.
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Member Profile Modification - edit one field only

Postby toddz88 » May 12th, 2011, 2:31 pm

Another way to phrase the question:

How can I update the value of a member's (s2m) Custom Registration Field, using php and a simple form in a theme template file?

Where and how is a user's s2m Custom Registration Field data stored?

thanks in advance, Todd
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Member Profile Modification - edit one field only

Postby Cristián Lávaque » May 12th, 2011, 5:47 pm

I'm pretty sure they are stored in the usermeta table.

Code: Select all
$s2member_custom_fields = get_user_option('s2member_custom_fields', $user_id); // An array.
 


https://codex.wordpress.org/Function_Re ... ser_option
https://codex.wordpress.org/Function_Re ... ser_option

I hope that helps. :)
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: Member Profile Modification - edit one field only

Postby toddz88 » May 14th, 2011, 5:16 am

bingo!
worked perfectly, thanks again Cristián.
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Member Profile Modification - edit one field only

Postby Cristián Lávaque » May 14th, 2011, 10:15 am

Great! :)
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


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 1 guest

cron