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™

Getting current user data wp_s2member_custom_fields

s2Member Plugin. A Membership plugin for WordPress®.

Getting current user data wp_s2member_custom_fields

Postby Charles91 » September 11th, 2011, 8:27 pm

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.
User avatar
Charles91
Registered User
Registered User
 
Posts: 2
Joined: September 11, 2011

Re: Getting current user data wp_s2member_custom_fields

Postby Bruce C » September 12th, 2011, 7:31 pm

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?
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: Getting current user data wp_s2member_custom_fields

Postby Charles91 » September 13th, 2011, 6:09 pm

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
User avatar
Charles91
Registered User
Registered User
 
Posts: 2
Joined: September 11, 2011

Re: Getting current user data wp_s2member_custom_fields

Postby Bruce C » September 13th, 2011, 8:15 pm

Cool. Glad to hear you worked it out.
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011


Return to s2Member Plugin

Who is online

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

cron