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.
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: Select all
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: Select all
$s2member_level1= get_option('wpu_roles_s2member_level1');
Same thing in the next section - you can see where I added:
- Code: Select all
$rolelist = array('administrator'=>$administrator, 'subscriber'=>$subscriber, 'author'=>$author, 'editor'=>$editor, 'contributor'=>$contributor, 's2member_level1'=>$s2member_level1);
And again:
- Code: Select all
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: Select all
$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: Select all
<tr>
<td colspan="3"><input name="wpu_roles_s2member_level1" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_s2member_level1')); ?> /> <?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: 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.