Page 1 of 1

Getting current user data wp_s2member_custom_fields

PostPosted: September 11th, 2011, 8:27 pm
by Charles91
I have been using the code below to get the current user zip code from the wp_usermeta, when I used a plugin called, Extra User Details.

<?php
global $current_user;
get_currentuserinfo();
$replace=$current_user->zip;
echo "$replace";
?>

I have installed s2Member and want to use it for my registration on my site, but it places the zip in a field called wp_s2member_custom_fields, with several of the custom fields, instead of placing it in a field by itself, is there a way I can extract the zip code from this field and use it as the current user zip. Or if not is there a way I can force it to place the zip in a single field, like it does first name and last name. I use the "$replace", in another plugin called Hungryfeed to display a RSS feed based on the zipcode of the user that is logged in.

Re: Getting current user data wp_s2member_custom_fields

PostPosted: September 12th, 2011, 7:31 pm
by Bruce C
If you set the zip code as a field in the s2Member registration, you should be able to use the [s2Get user_field="" /] to do this.

Is that what you're looking for?

Re: Getting current user data wp_s2member_custom_fields

PostPosted: September 13th, 2011, 6:09 pm
by Charles91
Thanks for the reply. I used something similar after playing with it a lot.

$replace_zip=$current_user->wp_s2member_custom_fields[zip];

I had an array with 3 custom fields in wp_s2member_custom_fields

Re: Getting current user data wp_s2member_custom_fields

PostPosted: September 13th, 2011, 8:15 pm
by Bruce C
Cool. Glad to hear you worked it out.