• How can I make a menu item visible only to logged in visitors who are NOT subscribed to any Memberpress subscription? Because users log in via an Azure AD oauth plugin, Memberpress is not assigning them a role. Logged in users are added to the wp user database as subscribers without a membership.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author shazdeh

    (@shazdeh)

    This will check if current user is a “subscriber”:

    
    is_user_logged_in() && in_array( 'subscriber', $GLOBALS['current_user']->roles )
    
    Thread Starter cindyjacks

    (@cindyjacks)

    I appreciate your prompt response! Unfortunately, this will still show the menu item to those with Memberpress subscriptions because they too are assigned the role of Subscribers in the WP database. I wish there was a way to make visible if user is logged in and hide it to the memberpress subscribers [e.g. current_user_can(‘mepr-active’,’membership: 639, 209′)]

    Thread Starter cindyjacks

    (@cindyjacks)

    Can we target the “Active Memberships” column of the WP user database? This column is created by Memberpress and lists None when a user isn’t subscribed to any membership.

    Plugin Author shazdeh

    (@shazdeh)

    Hi,

    Please consult with that plugin’s developers on what condition you have to use to check for active memberships.

    The Menu Item Visibility Control plugin allows you to use any expression, including that from other plugins. The code you need depends on what you want to achieve and what the other plugin offers, so you need to consult with the devs to see what condition you must use.

    Thread Starter cindyjacks

    (@cindyjacks)

    Thank you.

    Plugin Author shazdeh

    (@shazdeh)

    I did not know MemberPress had featured the plugin on their documentation, and even made a video on it too! This warms my cold heart ?? Thank you @mocode!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show to logged in users and hide to specific memberships’ is closed to new replies.