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™

Members List

s2Member Plugin. A Membership plugin for WordPress®.

Members List

Postby carblanco » June 9th, 2011, 12:06 pm

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.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 9th, 2011, 9:31 pm

So you want to get a list of all members sorted by a certain custom profile field?
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: Members List

Postby carblanco » June 10th, 2011, 1:57 am

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.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 10th, 2011, 11:55 am

OK. By filter you mean only showing those?
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: Members List

Postby carblanco » June 10th, 2011, 12:22 pm

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.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 10th, 2011, 12:43 pm

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?
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: Members List

Postby carblanco » June 12th, 2011, 4:47 am

Yes! and I'd prefer the server side, right?

Thanks.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 12th, 2011, 1:25 pm

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
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: Members List

Postby carblanco » June 13th, 2011, 7:28 am

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?
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 13th, 2011, 8:28 pm

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...
); 
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: Members List

Postby carblanco » June 14th, 2011, 2:25 am

Ok, I'll try :?
Anyway, do you think I could use the API function get_user_field()?
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 14th, 2011, 2:53 am

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.
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: Members List

Postby carblanco » June 14th, 2011, 3:12 am

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.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby Cristián Lávaque » June 14th, 2011, 9:49 am

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.
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: Members List

Postby carblanco » June 15th, 2011, 5:06 am

Finally can't find the way to use ksort... any other option?
Thanks.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby carblanco » June 23rd, 2011, 2:54 am

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.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby antseo » September 13th, 2011, 7:27 pm

does the pro version offer this feature now?
User avatar
antseo
Experienced User
Experienced User
 
Posts: 127
Joined: September 2, 2011

Re: Members List

Postby carblanco » September 18th, 2011, 4:53 pm

No, so I'm moving to other plugin.
User avatar
carblanco
Registered User
Registered User
 
Posts: 39
Joined: May 4, 2011

Re: Members List

Postby satdaya » January 10th, 2012, 1:12 pm

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. :-(
User avatar
satdaya
Registered User
Registered User
 
Posts: 5
Joined: November 28, 2011

Re: Members List

Postby Cristián Lávaque » January 12th, 2012, 6:06 am

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
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: Yahoo [Bot] and 1 guest

cron