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™

Showing user roles after login?

s2Member Plugin. A Membership plugin for WordPress®.

Showing user roles after login?

Postby tripleaaadelay » November 23rd, 2011, 8:30 pm

Hi guys,

I'm trying to show the s2Member user roles on my theme after users login.

In my header.php I can see this array:

$role = array(
10 => __( 'Administrator' , 'cosmotheme' ) ,
7 => __( 'Editor' , 'cosmotheme' ) ,
2 => __( 'Author' , 'cosmotheme' ) ,
1 => __( 'Contributor' , 'cosmotheme' ) ,
0 => __( 'Subscriber' , 'cosmotheme' ),
'' => __( 'Subscriber' , 'cosmotheme' )
);

How can I add the s2member roles?

Thanks,
Aaron
User avatar
tripleaaadelay
Registered User
Registered User
 
Posts: 42
Joined: August 17, 2011

Re: Showing user roles after login?

Postby Bruce C » November 24th, 2011, 1:44 am

You should be able to do something along these lines:

Code: Select all

<?php
global $wp_roles;
    foreach ( 
$wp_roles->role_names as $role => $name )
                {
                        if (
current_user_can($role))
                                echo 
$role;
                }

?>
~Bruce ( a.k.a. Ace )

If you're interested in a Professional Installation, or Custom Coding Job, you can send your request here.

Proud Supporter of:
The Zeitgeist Movement
and Occupy Everything
User avatar
Bruce C
Experienced User
Experienced User
 
Posts: 337
Joined: July 20, 2011

Re: Showing user roles after login?

Postby tripleaaadelay » November 24th, 2011, 8:57 am

Thanks for the tip Ace, but I'm really a novice. I messaged the theme company and they said just add the roles straight in to the array. What would that look like using the example above... or can you explain your version in a bit more detail?

Thx,
Aaron
User avatar
tripleaaadelay
Registered User
Registered User
 
Posts: 42
Joined: August 17, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron