Community Support Forums — WordPress® ( Users Helping Users ) — 2012-02-02T14:23:30-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=6536 2012-02-02T14:23:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=62165#p62165 <![CDATA[Re: Members List Tutorial by leialee31]]>
How would the code be modified to display the selected values (multiple) from an s2Member custom checkbox field?

Code:
if ($curauth->wp_s2member_custom_fields["favs"]) {
         $html .= "<p><strong>Favorite Plugins:</strong> ".$curauth->wp_s2member_custom_fields["favs"].",\n";
   }


Thanks again!

Statistics: Posted by surveysayz — February 2nd, 2012, 2:23 pm


]]>
2011-09-27T00:25:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=40457#p40457 <![CDATA[Re: Members List Tutorial by leialee31]]> Statistics: Posted by Cristián Lávaque — September 27th, 2011, 12:25 am


]]>
2011-09-13T19:41:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=35918#p35918 <![CDATA[Re: Members List Tutorial by leialee31]]> Statistics: Posted by antseo — September 13th, 2011, 7:41 pm


]]>
2011-07-14T01:22:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=28369#p28369 <![CDATA[Re: Members List Tutorial by leialee31]]>
dskallman wrote:
Is it possible to add a search/sort option to this setup? Would like to add that option since it's a large membership base?

Thanks!

It would be great, I'm also looking for it but it's no very easy.
I'm waiting for the s2member developers to develop some sort options.

Statistics: Posted by carblanco — July 14th, 2011, 1:22 am


]]>
2011-07-13T08:53:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=28278#p28278 <![CDATA[Re: Members List Tutorial by leialee31]]>
Thanks!

Statistics: Posted by dskallman — July 13th, 2011, 8:53 am


]]>
2011-06-13T16:57:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=20627#p20627 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]> Anyway Cristián is trying to help me here, maybe you want to join the discussion ;-)

Statistics: Posted by carblanco — June 13th, 2011, 4:57 pm


]]>
2011-06-13T12:58:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=20621#p20621 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]> Statistics: Posted by leialee31 — June 13th, 2011, 12:58 pm


]]>
2011-06-09T10:09:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=20465#p20465 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]> Right now I hava a list ordered as:
Code:
$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.

Statistics: Posted by carblanco — June 9th, 2011, 10:09 am


]]>
2011-06-07T10:28:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=20318#p20318 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]>
You order the listings by user ID using:
Code:
$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";

How can I order the list by s2member_custom_field["company_name"]?
Which would be the right $query?

I think I'm writing something wrong in the code.

Thanks.

Statistics: Posted by carblanco — June 7th, 2011, 10:28 am


]]>
2011-05-30T11:22:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=16309#p16309 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]>
Do you know how I can add some filters just to list the users based on mobile_phone or on birth_date, for instance?
Or simply adding a filter by letter (click on "A" to go to users beginning with a "A" letter)?

Thanks again.

Statistics: Posted by carblanco — May 30th, 2011, 11:22 am


]]>
2011-05-24T01:42:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=15749#p15749 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]> Statistics: Posted by leialee31 — May 24th, 2011, 1:42 am


]]>
2011-05-23T21:11:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=15722#p15722 <![CDATA[Re: Members List Tutorial Submitted by ( leialee31 )]]> Thank you VERY much for submitting this detailed tutorial.

I'm glad to see that you got things working the way you need them to.
For search functionality, I think you'll find this WordPress class helpful, it is documented here:
http://codex.wordpress.org/Function_Ref ... User_Query

Statistics: Posted by Jason Caldwell — May 23rd, 2011, 9:11 pm


]]>
2011-05-23T18:37:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=15705#p15705 <![CDATA[Re: Adding Buddypress with an existing s2member user base]]> 3. Displaying Level 1 Members on the list page
Originally, I had a block of code that broke the s2member custom field data into an array before displaying it. However, after some testing, it doesn't seem like it's necessary, which is hilarious because I definitely spent way too much time getting that to work before noticing that it didn't seem to matter if it happened or not. Whoops.

So, the public list of all Level 1 members (Participants) is located here: http://www.northsideopenstudios.org/view-members

The first change I made was having the users order by ID rather than their name, and display by a custom field I'd created called "Listing Title" rather than by their "nicename". Users actual names are only for internal use, since most of them are running their listings as galleries and collectives.

Around line 100 look for:
Code:
   $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.user_nicename LIMIT $offset, $limit";


And change it to:
Code:
   $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";


This just orders the listings by user ID, which I did because nicenames are irrelevant to what I'm doing.

Then, you're ready to add whatever s2member custom field data you need to function get_user_listing($curauth). For example, I changed the following:
Code:
$html .= "<div class=\"wpu-id\"><a href=\"" . get_permalink($post->ID) . $concat . "uid=$curauth->ID\" title=\"$curauth->display_name\">$curauth->display_name</a></div>\n";


To this:
Code:
$html .= "<div class=\"wpu-id\"><a href=\"" . get_permalink($post->ID) . $concat . "uid=$curauth->ID\" title=\"$curauth->display_name\">" . $curauth->wp_s2member_custom_fields["listing_title"] . "</a></div>\n";


The key to getting the fields is always writing them as $curauth->wp_s2member_custom_fields["field ID of the custom field you want to display"]. $curauth is wp-users' variable for fetching the user ID and relevant details.

You can add as many of these fields as you like. I kept it simple for now.

4. Displaying individual members' profiles
When clicked, each listing title directs you to an individual profile for each Member. In the same way as above, edit function display_user() to pull the s2member fields into each person's page.

I wanted each display field to be conditional (so that no one would have empty fields). To achieve this, I added a bunch of iterations of the following, with the field changed to be whatever I was trying to pull. This one, for example, is making sure that there's a website listed in the person's profile (in my s2member custom fields, it was "website_url", then, if there is, it pulls that url and makes it a hyperlink. Thanks to s2member's ability to require that URLs be typed in full, this flows perfectly:
Code:
if ($curauth->wp_s2member_custom_fields["website_url"] && $curauth->wp_s2member_custom_fields["website_url"] != "http://")
{
      $html .= "<p><strong>WEBSITE:</strong> <a href=\" ".$curauth->wp_s2member_custom_fields["website_url"]." \" rel=\"nofollow\">".$curauth->wp_s2member_custom_fields["website_url"]."</a></p>\n";
   }


That's just an example, as you can see I also commented out several features (I did not want anyone to make comments on my listings, or show posts by each author, which are features included in wp-users).

5. Styling
So that's pretty much it, except that the default list and profile layouts are hideous. I edited wpu-styles.css, the stylesheet included with wp-users (NOT your general wordpress stylesheet) and changed the attributes of all the different divs. For example, to get a grid view like I have, I changed .wpu-user to float left and crop the user's image to create a fun closeup abstract view of their User Photo.


So, yeah, that's how I created my paid membership directory. I hope this is helpful to someone out there like me who doesn't know much php. :)

Ideally, I would REALLY love to build in some search functions - at first to just be able to search generally, and later (when I learn more) to make the list sortable by people looking for artists in particular neighborhoods, or who work in particular mediums. So far, all these details are there thanks to s2member custom fields, but I'm not quite ready to go about building a search thing, so they're invisible right now. If anyone knows how to do that, I'd be very grateful to hear how I might integrate that functionality!

I'll give this tutorial a look over later to make sure I haven't missed anything. Thanks to Christian and Jason for a great plugin with great support.

Statistics: Posted by leialee31 — May 23rd, 2011, 6:37 pm


]]>
2011-05-23T17:32:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6536&p=15693#p15693 <![CDATA[Members List Tutorial by leialee31]]>

Steps:

1. Plugins to use
2. Adding the s2member roles to wp-users.php and the admin dashboard
3. Displaying Level 1 Members on the list page
4. Displaying individual members' profiles
5. Styling

1. Plugins to use

Front-end Editor (http://wordpress.org/extend/plugins/front-end-editor/) - To place an "edit my information" form in a restricted page. Users must sign in to edit their information, but never have to see the dashboard.
User-Photo (http://wordpress.org/extend/plugins/user-photo/) - Adding this plugin places an upload field in each user's profile form, and automatically creates a thumbnail version of each photo.
WP-Users (http://wordpress.org/extend/plugins/wordpress-users/)- I used the Wordpress-Users plugin because I wasn't having any success with members-list. I'm not the brightest bulb when it comes to code and for whatever reason I found its php a little easier to parse mentally. I also wanted the list to be clickable to individual profiles, and I couldn't make members-list do that. Fortunately, WP-Users was built to be compatible with the User Photo plugin and already has some stuff in there to access user images.
s2member - DUH.

2. Adding the s2member roles to wp-users.php and Wordpress-Users' section on the admin dashboard
My users have two levels. When they first register, they are "Pending Approval", which is level 0. After paying or being manually upgraded, they are "Participants", or level 1. There is another level I used for special spaces but never mind that right now. :D

The first thing to do was add s2member's custom roles in wp-users.php (the Wordpress Users main file). There are three places this needs to be added.

At the top of wp-users.php in function wpu_get_roles() you'll need to edit the following sections:
Code:
function wpu_get_roles()

{

   global $wpdb;


   $administrator = get_option('wpu_roles_admin');

   $subscriber = get_option('wpu_roles_subscriber');

   $author = get_option('wpu_roles_author');

   $editor = get_option('wpu_roles_editor');

   $contributor = get_option('wpu_roles_contributor');

Add whatever level you want to be able to limit the list to. For me it was:
Code:
$s2member_level1= get_option('wpu_roles_s2member_level1');


Same thing in the next section - you can see where I added:
Code:
$rolelist = array('administrator'=>$administrator, 'subscriber'=>$subscriber, 'author'=>$author, 'editor'=>$editor, 'contributor'=>$contributor, 's2member_level1'=>$s2member_level1);


And again:
Code:
   if (empty($roles))
              $roles = array('administrator', 'subscriber', 'author', 'editor', 'contributor', 's2member_level1');


You'll also want to add it to the dashboard so that you can easily change the roles you want to display. Go to function wpu_admin() a little after line 900 in wp-users, and add:
Code:
   
$roles_s2member_level1 = $_POST['wpu_roles_s2member_level1'];
update_option('wpu_roles_s2member_level1', $roles_s2member_level1);


Then find the wpu_admin_form near the end of the code, and add this to the table already built there to create a checkbox for your new roles:
Code:
  <tr>
<td colspan="3"><input name="wpu_roles_s2member_level1" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_s2member_level1')); ?> />&nbsp; <?php _e("Participants" ); ?>
</td>
</tr>


You should now have your custom roles added to Wordpress Users, and be able to select which roles to include in your list by checking the appropriate box in wp-users dashboard section. Like this: Picture 5.png You can select multiple roles as long as you add them first in all those places. My list shows only my paid members (who are automatically added to the list when they pay), and updates their profiles whenever they do since it's just pulling their data.

Statistics: Posted by leialee31 — May 23rd, 2011, 5:32 pm


]]>