deny access to admins – PHP errors
-
Hi, I’m using the below snippet from @danbp
// deny access to admins profile. User is redirected to the homepage function bpfr_hide_admins_profile() { global $bp; if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) : wp_redirect( home_url() ); exit; endif; } add_action( 'wp', 'bpfr_hide_admins_profile', 1 );
When enabling WP_DEBUG, I get the following errors:
- Use of undefined constant bp_is_profile – assumed ‘bp_is_profile’ in …/fonctions.php in line 291
- Undefined property: stdClass::$id in …/fonctions.php in line 291
Although the redirect works fine, is there any way to resolve these 2 errors?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.