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™

how to list custom registration fields from ALL users?

s2Member Plugin. A Membership plugin for WordPress®.

how to list custom registration fields from ALL users?

Postby nusatsum » July 29th, 2011, 9:50 pm

I have a business directory.

Subscribers have custom registration fields where they can specify the information about their business and manage it in their profile.

I would like to generate a list of all subscriber's business_title's for example.

Where should I begin?

I have looked into get_users (wordpress) but it doesn't return the custom registration fields.

S2member's S2MEMBER_CURRENT_USER_FIELDS is only for the current user. How would I get this for all users that fit a particular criteria (in my case role=subscriber).

Any help would be appreciated.
User avatar
nusatsum
Registered User
Registered User
 
Posts: 6
Joined: July 29, 2011

Re: how to list custom registration fields from ALL users?

Postby Cristián Lávaque » July 30th, 2011, 9:44 pm

This thread may help you viewtopic.php?f=4&t=10414
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: how to list custom registration fields from ALL users?

Postby nusatsum » August 1st, 2011, 12:44 pm

Thanks Cristián but after a couple of hair pulling days I must admit I'm not getting anywhere. Over in another thread (http://www.primothemes.com/forums/viewtopic.php?f=4&t=6217 ) you recommended using custom registration fields to implement a business directory. I realize now I would have to spend a lot of time understanding the underlying frameworks in order to use this approach. Unless someone could help with a code snippet?

All I need is to list the custom fields for all users in a loop.

Pretty please? :P
User avatar
nusatsum
Registered User
Registered User
 
Posts: 6
Joined: July 29, 2011

Re: how to list custom registration fields from ALL users?

Postby Cristián Lávaque » August 1st, 2011, 9:56 pm

There isn't a straightforward way to do that yet. You can't just query the database based on that custom field because s2Member custom fields are currently saved in an associative array.

You'd have to load the custom fields for every member, put them in an associative array with the custom field as the key so you can sort the array by it, and then loop it.

Or something of the sort depending on the exact use you want. I don't have time to develop it at this moment, but a freelance developer should be able to do it for you.
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: how to list custom registration fields from ALL users?

Postby nusatsum » August 1st, 2011, 11:40 pm

I see. Thanks for filling me in. I did purchase a pro license. I would have no problem coding what you suggested if only I understood s2member a little better. For example, how would I get the custom user profile fields by user ID when all the functions are intended for the current user? Is there a built-in facility to do this? I appreciate your assistance.
User avatar
nusatsum
Registered User
Registered User
 
Posts: 6
Joined: July 29, 2011

Re: how to list custom registration fields from ALL users?

Postby Cristián Lávaque » August 2nd, 2011, 1:27 am

Code: Select all
$s2_custom_fields get_user_option('wp_s2member_custom_fields'$user_id); 


:)
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: how to list custom registration fields from ALL users?

Postby nusatsum » August 2nd, 2011, 2:27 am

Thank you!
User avatar
nusatsum
Registered User
Registered User
 
Posts: 6
Joined: July 29, 2011

Re: how to list custom registration fields from ALL users?

Postby Cristián Lávaque » August 2nd, 2011, 10:52 pm

;)
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: Google [Bot], Yahoo [Bot] and 3 guests

cron