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™

Hook to filter Custom Registration Field data?

s2Member Plugin. A Membership plugin for WordPress®.

Hook to filter Custom Registration Field data?

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

On my s2mPro payment form, I have a custom registration field -- a Checkbox that the user must click to accept a User Agreement / TOS. By default, the checkbox value is "1" which gets stored in the member's profile.

But we need this value to be a TimeStamp (YYYY-mm-dd H:i:s) instead of just "1".

Does anyone know a Filter / Hook I can use to make this change as it's written to the database?

Alternatively, I suppose we could try a hook to change the value in the html form, but of course I prefer to handle it server-side.

Thanks!
Todd
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Hook to filter Custom Registration Field data?

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

Hi Todd. :)

The registration time is also stored in the database. Isn't it enough to check that since it'll be the same as the User Agreement/TOS acceptance time?

If you go to WP Admin -> Users, you'll see a column named Registration Date, which has date and time of the registration. You can get it from the database and work with it if you need 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: Hook to filter Custom Registration Field data?

Postby toddz88 » May 14th, 2011, 12:51 pm

True. I can use the timestamp of the registration, as $current_user->user_registered, to display this.

On our site, some members will be clicking the "I agree" button during registration (so this method is fine for them), but other members (who do not use the payment form) will click it sometime after being registered. I have handled those users with a s2m Custom Registration Field.

So I do have all the data (the timestamps), and thus i can pull from either field when displaying data on the front-end. I was just hoping to unify the field used to store it, by putting the timestamp of registration (generated by the payment form) into my "user agreeement" field (the custom reg field), instead of the default "1" that s2m is currently using. No biggie, just thought i'd try, if there was an easy to find/use hook.

Thanks as always!
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Hook to filter Custom Registration Field data?

Postby Cristián Lávaque » May 14th, 2011, 1:21 pm

There must be a way. Like you said, you could change the value of the checkbox from 1 to a timestamp, and instead of it being formatted as a date, you could use the time in seconds, which is just an integer and few would know what to change it to or bother. Would that work?
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