Support » Plugin: Members » Display User Role on My Account Page

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Justin Tadlock

    (@greenshady)

    If you have access to the user ID, you can do this:

    
    <?php $user = new WP_User( $input_user_id_here ); ?>
    
    <ul>
    	<?php foreach ( (array) $user->roles as $role ) : ?>
    		<li><?php echo esc_html( $role ); ?></li>
    	<?php endforeach; ?>
    </ul>
    
    altmayank

    (@altmayank)

    Thanks for the reply. This code works and displays the role, but I would like to display the role name instead, is there anyway to do that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.