Support » Plugin: Multiple Roles » Roles List in your own profile

  • Hi

    thanks for this neat little plugin, replacing another unmaintained one!
    However, lacking hooks to modify the behaviour on showing roles on your own profile , I had to modify your controller checklist. But I’d rather have you offering an option in settings:

    1. If I check my profile (being admin) I see nothing, as this seems to return false:
    As amdin I am sure I can edit my roles as I am admin and it works!
    of course, it is tried to prevent, that user can change their roles, which is fine, but as an admin I want to see it for me AND
    2. users shall be able to also check their roles (readonly), so I did:

    public function output_checklist( $user ) {
       $writable = $this->model->can_update_roles();
       #if ( !$this->model->can_update_roles() )          return;
       wp_nonce_field( 'update-md-multiple-roles', 'md_multiple_roles_nonce' );
       $roles        = $this->model->get_roles();
       $user_roles   = $user->roles;
          include( MDMR_PATH . 'views/checklist.html.php' );
          include( MDMR_PATH . 'views/checklist_r.html.php' );

    and in template checklist_r.html.php simply

     * Output the roles checklist.
     * @var $roles array All WordPress roles in name => label pairs.
     * @var $user_roles array An array of role names belonging to the current user.
    <table class="form-table">
             <?php foreach( $roles as $name => $label ) : ?>
                <label for="md-multiple-roles-<?php echo $name; ?>">
                      <?php $hasIt = in_array( $name, $user_roles ) ?>
                      if($hasIt) echo "<b class='roleMember'>$name</b>";
                      else echo "<span class='notMember'>$label</span>";
                <br />
             <?php endforeach; ?>

    Any chance to have this (or similar) in your code natively?

    Thanks you

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’d also like to see this functionality.

    Yes please, I second this.

    I try to build a web app for my sporting club, which relies on capabilities. Instead of adding the newly created capabilities to for example the administrator account, it would make more sense for me to simply add a new additional role.


    Also looking for something like this… displaying/edit user roles in the profile.

    Any ideas would be helpful since I am not a programmer.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Roles List in your own profile’ is closed to new replies.