Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 23,840
- How-to & Troubleshooting
- 129,881
- Creating & Extending
- 25,910
- Requests & Feedback
- 9,553
- Third Party Plugins
- 9,832
- Showcase
- 3,316
- Ideas
- 1,402
- Miscellaneous
- 9,183
-
Allow admin: current_user_can( 'manage_options' )
Allow the profile owner: bp_loggedin_user_id() == bp_displayed_user_id()
You might use it like this:
if ( current_user_can( 'manage_options' ) || bp_loggedin_user_id() == bp_displayed_user_id() ) {
//do something
}
It is also best practice to check that the component is active to avoid errors on update or when BP is deactivated. In this case, xprofile.
if ( bp_is_active( 'xprofile' ) )