Support » Plugins and Hacks » Paid Memberships Pro » Displaying divs based on membership level

Displaying divs based on membership level

  • Hello,

    I’m working on a site where people will be able to see profiles for members to my site. What I need to be able to do is display specific divs on these profile pages depending on that member’s subscription level.

    I’ve used the below code in the past, but obviously it’s based on role rather than membership level:

    $user = new WP_User( $post->post_author );
    						if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
            					foreach ( $user->roles as $role )
                    				echo $role;}
    						if ( $role == 'editor' ){echo "You can see this because you're an editor";}

    I want to accomplish basically the same thing that this code does, but rather than by role, do it by membership.

    Any thoughts? Thanks!



  • The topic ‘Displaying divs based on membership level’ is closed to new replies.