Page 1 of 1

s2member pro - how to search members

PostPosted: May 10th, 2011, 1:29 am
by lordjoshua
One of the levels of membership on the project I am working on needs to be searchable. That is, this level has businesses signing up (level 3), and then customers (levels 0,1,2) need to be able to search the "directory" (which is anyone and everyone signed up on level 3. The search needs to be able to query any of the custom fields generated in the s2member program that apply to level 3. Is there an easy way to do this that I am missing? Some kind of shortcode i need to drop in a page to make this happen? Or is there a different pluggin that anyone is aware of that i can use to specifically tell it what fields in the s2member database to query? Any ideas?

Re: s2member pro - how to search members

PostPosted: May 10th, 2011, 11:50 am
by Cristián Lávaque
You could create your custom directory using the get_users function to get the IDs of users at Level 3 and then get the rest of the data you want to display in the directory with get_user_option.

http://codex.wordpress.org/Function_Reference/get_users
https://codex.wordpress.org/Function_Re ... ser_option

Code: Select all
foreach(get_users("role=s2member_level3") as $user) {
    echo 
get_user_option('first_name'$user->ID);
}
 


I hope that helps.

Re: s2member pro - how to search members

PostPosted: May 10th, 2011, 12:14 pm
by Cristián Lávaque
Actually, since you need several things for each user, it may be best to use something like get_userdata. https://codex.wordpress.org/Function_Re ... t_userdata

Re: s2member pro - how to search members

PostPosted: May 10th, 2011, 3:43 pm
by lordjoshua
Hi Cristian - this is my first "complicated" wordpress site, so I appreciate you bearing with me during my learning curve. Here is my first stupid question - where do I drop this code into?

The following are the slug names that i need searchable.

Text ( single line ) business_name_biz yes 3
Text ( single line ) first_name_biz yes 3
Text ( single line ) last_name_biz yes 3
Text ( single line ) email_biz no 3
Text ( single line ) contact_number_biz yes 3
Text ( single line ) business_number_biz yes 3
Text ( single line ) street_number_biz yes 3
Text ( single line ) street_name_biz yes 3
Text ( single line ) street_suffix_biz yes 3
Text ( single line ) city_biz yes 3
Select Menu ( drop-down ) state_biz yes 3
Text ( single line ) zip_code_biz yes 3
Textarea ( multi-line ) discount_details_biz yes 3
Select Menu ( multi-option ) business_catagory_biz yes 3

What would the code look like and where do I put it?

Again - I truly appreciate your patience with me. I love s2member, and besides this I have everything else all configured and figured out!

Re: s2member pro - how to search members

PostPosted: May 10th, 2011, 3:49 pm
by Cristián Lávaque
No problem.

Hmm... My best suggestion would probably be that you get a freelance develper who creates this directory page for you. viewforum.php?f=37

I hope that helps. :)