Page 1 of 1

Members List

PostPosted: June 9th, 2011, 12:06 pm
by carblanco
Hi all,

I'm having a lot of problems for listing all registered members with certain level.
Right now I've followed up this tutorial but I need more functionalities like search and filter by some s2member custom fields.

I can't imagine why s2member does not have this kind of functions because if you are a Pro user you can export users as csv and open it with Excel, and then you can search, add filters, etc.
Other option could be publishing the csv using Google Docs, but that's not the way.
I mean, the work is almost done.

Anybody can help me with this? Any hint?

Thanks.

Re: Members List

PostPosted: June 9th, 2011, 9:31 pm
by Cristián Lávaque
So you want to get a list of all members sorted by a certain custom profile field?

Re: Members List

PostPosted: June 10th, 2011, 1:57 am
by carblanco
Yes and no ;-)

Yes because actually, provisionally, I have to list sorting by a custom field call "company_name".

And no because what I really need is the possibility to list all members (level1 + level2, for instance) but with the filters, I mean, filtering by "company_name" or by "phone" or by "company_name + phone", similar to automatic filters in excel.

Thanks.

Re: Members List

PostPosted: June 10th, 2011, 11:55 am
by Cristián Lávaque
OK. By filter you mean only showing those?

Re: Members List

PostPosted: June 10th, 2011, 12:22 pm
by carblanco
Not necessarily.
Do you know the "autofilters used in Excel or Google Spreadsheets? You can order a list by a custom field or show only the selected ones. I mean, if I have two custom fields like company_name and company_state I'd like to order by company_name (ASC, DESC) or filter by companies only with a selected company_state.
For example, something like this but using s2member custom fields.

Thanks again.

Re: Members List

PostPosted: June 10th, 2011, 12:43 pm
by Cristián Lávaque
You mean the dropdowns in that spreadsheet? If you want the filtering to happen in the browser you need to use JavaScript, if you want the results to be served filtered then you work with the server. Where do you want it to happen?

Re: Members List

PostPosted: June 12th, 2011, 4:47 am
by carblanco
Yes! and I'd prefer the server side, right?

Thanks.

Re: Members List

PostPosted: June 12th, 2011, 1:25 pm
by Cristián Lávaque
OK...

carblanco wrote:Can anybody help me with this newie question?
Right now I hava a list ordered as:
Code: Select all
$query = "
SELECT $wpdb->users.ID, $wpdb->users.user_nicename
FROM $wpdb->users
INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id
WHERE $meta_values
ORDER BY $wpdb->users.ID LIMIT $offset, $limit";


And what I need is ordering by a s2member custom field called "company name". How?

Thanks.


Well, right now you can't do it with the database query, because the fields aren't stored in their own columns, they're all in an array. You would have to get the users with the field "company name" into an array and sort them there. You could use the field values as they keys and then ksort it. http://php.net/ksort

Re: Members List

PostPosted: June 13th, 2011, 7:28 am
by carblanco
Thanks again.
But I can't figure how to do that using ksort...

You are proposing something like
Code: Select all
$query = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
ksort($query);
foreach ($query as $company_name => $val) {
    echo "$company_name = $val\n";
}

I can't see what I have to write in array();

Also, is there any way to get always the 1st or 2nd or 10th column of the array?

Re: Members List

PostPosted: June 13th, 2011, 8:28 pm
by Cristián Lávaque
What I'm saying is that when you query the users who have a certain custom field, to sort it based on that field, you can give each element in the array a key using that field. Then you'll be able to sort the array by the keys (i.e. the custom field). You can't get the users sorted by the field with the database query because of how they're stored. So you could have

Code: Select all
$users_with_company_field = array(
    'The Company' => array(/* All this user's data you got with your query */), 
    
// More users...
); 

Re: Members List

PostPosted: June 14th, 2011, 2:25 am
by carblanco
Ok, I'll try :?
Anyway, do you think I could use the API function get_user_field()?

Re: Members List

PostPosted: June 14th, 2011, 2:53 am
by Cristián Lávaque
That works with a single user, you want to get all the users with a field, right? You need to query the database.

I'd be looking at https://codex.wordpress.org/Function_Re ... /get_users but in the end you'll probably need to write your own database query, since you don't know the exact value of the meta field (wp_s2member_custom_fields in the usermeta table). You need to search in it for the registration field's name, which will be in the string that is the serialized array.

Re: Members List

PostPosted: June 14th, 2011, 3:12 am
by carblanco
Ok, I see...
Why you don't add a function to list all members? (like member list plugin). I mean, you can do that easily, it's almost done with the export function ;)
I think there is a lot of people looking for this.

Re: Members List

PostPosted: June 14th, 2011, 9:49 am
by Cristián Lávaque
Jason is planning to create a members list for the Pro version, but it's still in the to-do, I don't have any estimated date for it.

Re: Members List

PostPosted: June 15th, 2011, 5:06 am
by carblanco
Finally can't find the way to use ksort... any other option?
Thanks.

Re: Members List

PostPosted: June 23rd, 2011, 2:54 am
by carblanco
Hi Cristián,

I'm looking for a developer to custom code this for me, but I was thinking that if you are planning to develop this feature maybe we could talk to boost it.
I can't send you a PM so if you don't mind please write me.

Anyway, is there any developer interested?

Thanks.

Re: Members List

PostPosted: September 13th, 2011, 7:27 pm
by antseo
does the pro version offer this feature now?

Re: Members List

PostPosted: September 18th, 2011, 4:53 pm
by carblanco
No, so I'm moving to other plugin.

Re: Members List

PostPosted: January 10th, 2012, 1:12 pm
by satdaya
I want this feature too. I'm having a headache with getting members list to work with either s2member or buddypress fields. What I needed was members list -> member profile AND s2member functionality to charge different membership levels.

The whole s2member method of handling profile fields really puts a screw in the whole process, if only the process actually created new user fields, that would be perfect, it would then become compatible with Members List.

Or the other option would be for s2member to create the member list ->profile functionality, that'd make it a fully robust solution to meet what seems like a LOT of people need, after I've scoured this and other plugins' forums to find a solution.

My last hope right now at getting this site up and running for the client is hanging on the Members List, on a forum post they mentioned they could get it to work with buddypress fields. I'm following up on that and hoping they did. Will report back here if they did. It seems like it's a matter of getting the profile fields drop down list on "configure markup" settings in Member List to populate the additional fields listed in the bp_ tables. Unfortunately, I'm no programmer so I can't do it. :-(

Re: Members List

PostPosted: January 12th, 2012, 6:06 am
by Cristián Lávaque
Yeah, I know that the way the custom fields are stored needs improvement. :|

About searching users by the custom field, this thread may be helpful: viewtopic.php?f=4&t=15658

I'm not sure how well Members List works s2Member, but you could try creating your own members list based on the code examples in that thread. Or, if you don't need to search by custom field, you can use the get_users function. http://codex.wordpress.org/Function_Reference/get_users

If you need from a develper, you may find a good freelance one at sites like odesk.com or elance.com. This page may also be helpful: viewforum.php?f=37