Forums

[resolved] [Plugin: Members] Show who has access to a page (2 posts)

  1. mikii
    Member
    Posted 5 months ago #

    Hi.

    I am using the "members" plugin Version 0.2 By Justin Tadlock and would like t be able to show which members have access to a specific page, by adding some code on that page.

    Can anyone help me to achieve this?

    THank you.

  2. mikii
    Member
    Posted 2 months ago #

    Hi. I got it to work. in case someone wanders, her's the code I am using (you need a plugin to allow php code on your page or widget text):

    <?php
    global $post;
    global $wp_roles;
    $roles = get_post_meta($post->ID, '_members_access_role', false );
    if (empty ($roles)) {
    echo "TUTTI";
    }
    else {
    foreach ( $wp_roles->role_names as $role => $name )
    {
    if ( is_array( $roles ) && in_array( $role, $roles ) ){
    echo '<p>',  $name, '<br \>', '</p>';
    }
    }
    }
    ?>

Reply

You must log in to post.

About this Topic