Tagged: membership levels, Paid Memberships Pro
Hi,
I notice you have a plugin to restrict upload levels to galleries for Paid Memberships Pro, but I would like to restrict access to actually viewing galleries for non paid users.
Does anyone have an idea/code snippet to do this? I’m sure it’s been done before.
Thanks,
Damian
Hi Damian,
Thank you for using MediaPress.You can use something like this
function mpp_custom_gallery_view_restriction() { if ( is_super_admin() || bp_is_my_profile() || ! mpp_is_single_gallery() || ! function_exists( 'pmpro_getMembershipLevelForUser' ) ) { return; } $level = pmpro_getMembershipLevelForUser( get_current_user_id() ); // do your check here and if ( ! $level ) { // restrict. bp_core_redirect( home_url( '/' ) ); } } add_action( 'bp_template_redirect', 'mpp_custom_gallery_view_restriction' );
Please modify it according to your need.
Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Restrict access to galleries based on Paid Memberships Pro membership levels’ is closed to new replies.
This topic is: resolved