Protected Content API for theme development

Hello!
Is there an API to get user and his/her membership information in the front-end?
In our case, we would like to filter the items of a dynamically generated menu dependent on the membership of the current user.

So in the moment of the menu-rendering, I need to know the membership of the current user and the allowed membership for a certain page-/post-id.

Is there a convenient way to get that information?

Thanks for your help!

  • Predrag Dubajic

    Hey @Martin,

    Hope you're doing well today

    I don't think there is currently easy way to get that info but there is a way to protect certain menu items for certain memberships, if this is one of the things you are looking to do.

    However we are currently working on some awesome updates for PC that will include API but I'm still not sure when will this be published.

    You could still trying out something like this in current version:

    $member = MS_Factory::load( ‚MS_Model_Member‘, get_current_user_id() );
    if ( $member->has_membership( 123 ) ) {
    / /your code here
    }

    Hope this helps.

    Best regards,
    Predrag