Page 1 of 1
Hook to filter Custom Registration Field data?
Posted:
May 14th, 2011, 5:42 am
by toddz88
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
Re: Hook to filter Custom Registration Field data?
Posted:
May 14th, 2011, 10:23 am
by Cristián Lávaque
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.
Re: Hook to filter Custom Registration Field data?
Posted:
May 14th, 2011, 12:51 pm
by toddz88
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!
Re: Hook to filter Custom Registration Field data?
Posted:
May 14th, 2011, 1:21 pm
by Cristián Lávaque
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?