• Resolved bredamcguigan

    (@bredamcguigan)


    HI,
    Is there a quick way to see all pages that have restrictions on them in the admin area? I was hoping there would be a screen option in pages to show the role if these was a member setting applied?
    thanks
    Breda

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi Breda,

    If you want to display roles that have permissions to access each page in the Pages admin area in new column, you can add this code at the end of your theme’s functions.php file:

    
    add_filter('manage_pages_columns', function($column) {
      $column['roles'] = 'Roles';
      return $column;
    });
    add_action('manage_pages_custom_column', function($val, $post_id) {
      $roles = get_post_meta( $post_id, '_members_access_role', false );
      if(!empty($roles)) {
        echo ucwords(implode(', ', $roles));
      }
    }, 10, 2);

    Hopefully, that helps.

    Thread Starter bredamcguigan

    (@bredamcguigan)

    Thanks I will try that.
    Regards
    Breda

    @caseproof,

    I tried your function but it messes badly with Yoast. It prepends the Roles to the text in the Yoast columns.

    Any ideas?

    Thanks, Scott

    Plugin Author Caseproof

    (@caseproof)

    Hi @scottp007

    Sorry about that mess. Please replace the previous version with this code:

    
    add_filter('manage_pages_columns', function($column) {
      $column['roles'] = 'Roles';
      return $column;
    });
    add_action('manage_pages_custom_column', function($val, $post_id) {
      if($val === 'roles') {
        $roles = get_post_meta( $post_id, '_members_access_role', false );
        if(!empty($roles)) {
          echo ucwords(implode(', ', $roles));
        }
      }
    }, 10, 2);

    Best

    Hi @caseproof

    Thanks for the update, much better! Appreciate your help.

    Regards, Scott

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show role in Page Admin area’ is closed to new replies.