How do I link Membership level to a User Role using "Membership" plugin?

I'd like to have 2 levels of registered users in my site: "Subscribers" who can only read some posts (same capabilities as WordPress user role "subscriber"), and "Analysts" who can read everything and also write posts (capabilities as Wordpress user role "author").

Q1: Is there a way to attach a user role to a subscriber level?
Q2: In Buddypress Members page (member-loop.php), how do I loop through each of the subscriber types separately? first, list all "Subscribers", then list all "Analysts"?

Q3: Is there a template tag that can be used easily in .php file instead of shortcodes? For example, I want to have a specific part of a template presented to user-level 1 by using something like if(is_userlevel(1)) instead of the cumbersome <?php echo do_shortcode('[...]'); ?>

  • aristath

    Q1: Is there a way to attach a user role to a subscriber level?

    Yes. When you edit an access level, there are 3 main options: Negative rules, Positive rules and Advanced.
    If you use the Advanced rules, you'll be able to select a user role.

    Q2: In Buddypress Members page (member-loop.php), how do I loop through each of the subscriber types separately? first, list all "Subscribers", then list all "Analysts"?

    That's a tough one...
    You'll have to custom code this and check the user levels on your loop using these functions: https://premium.wpmudev.org/forums/topic/checking-member-level-via-php#post-104672

    Q3: Is there a template tag that can be used easily in .php file instead of shortcodes? For example, I want to have a specific part of a template presented to user-level 1 by using something like if(is_userlevel(1)) instead of the cumbersome <?php echo do_shortcode('[...]'); ?>

    See the link posted above. :slight_smile:

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.