• Resolved justbishop

    (@justbishop)


    I am currently using the following piece of code to display a user’s role on the front end, but it seems to only display the “main” role, or the role the user was assigned prior to the plugin installation. Is there a way to alter this to have it display ALL roles assigned to a user, or something that can be done with the plugin to give me the option of which role to display for each user?

    <?php the_author_posts_link(); ?> - <?php
        $aid = get_the_author_meta('ID');
        $role = get_user_role( $aid );
    	$wp_roles = wp_roles();
    	$pretty_role = $wp_roles->roles[$role]['name'];
        echo $pretty_role;
        
    ?>
Viewing 1 replies (of 1 total)
  • Plugin Author Florian TIAR

    (@mista-flo)

    Yes, you can do it easily with the plugin with this code :

    
    $model = new MDMR_Model();
    $roles = $model->get_user_roles( $user_id );
    

    Sorry for the long time response.

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Roles on Front End’ is closed to new replies.