Created
December 13, 2019 23:21
-
-
Save landbryo/faa352f5a87e42ed43f9f16a65061350 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Require user to have access level to view BuddyPress page | |
*/ | |
add_filter( 'rcp_member_can_access', function ( $can_access ) { | |
$access_level = 4; | |
$page_slug = 'activity'; | |
$customer = rcp_get_customer_by_user_id( get_current_user_id() ); | |
if ( empty( $customer ) ) { | |
return $can_access; | |
} | |
global $post; | |
if ( $post->post_name == $page_slug && ! $customer->has_access_level( $access_level ) ) { | |
$can_access = false; | |
} | |
return $can_access; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment