Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide a div based on authors pmpro role level


  • rpandassociates
    Participant

    @rpandassociates

    I need to Hide a div based on authors pmpro role level or wp role level?

    I have 2 types of account sellers and buyers
    on the buddypress members page of the seller I have added a button to take them to the sellers storefront

    I added this to the members-header inside my themes buddypress

    <div id=”item-header-avatar2″ class=”btn btn-default” >
    “> Buy Training Packages

    </div>

    simple button as the storefront url is always the same as the users name

    however well this also adds the button to the buyers pages and they dont have a storefront 🙂

    so I need a way to filter the button according to the authors/buddypress member page being viewed if the author is a buyer or pmppro level 1 WProle= subscriber then this div will not be displayed in their buddypress page

    I foud this snippet for pmpro
    Check for a specific user_id (i.e. not the current user).

    <?php
    $user_id = 1; //some other user
    if(pmpro_hasMembershipLevel(1, $user_id))
    {
    ?>
    //Place your HTML or PHP code here if the user is in the required membership level

    <?php
    }
    ?>

    soo…..

    if(pmpro_hasMembershipLevel(1, $user_id))

    should be ????

    if(pmpro_hasMembershipLevel(1,bp_displayed_user_id()))

    as this states it is a free pmpro level 1 member aka subscriber,buyer and the user id is drawn from the users profile page being viewed right?

    so if the above pmpro function is correct how do i apply it to hide the div sorry I am new to this stuff and lack the basic php fundamentals i guess 🙂

    so if anyone can help and take my div code and show me how to hide it by the authors role either wp role of pmpro role just need to hide the store front button if the user doesnt have a store . thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hide a div based on authors pmpro role level’ is closed to new replies.
Skip to toolbar