My client is using Buddypress on his Wordpress site, but he don't want users to edit their profile in Buddypress.
Also he don't want users to go to their /profile/edit
page when clicking on the adminbar.
So I'm looking for a way to change the url in de adminbar to the profile view page,or a way to redirect the profile/edit
page to the profile view page.
So from: http://[website-url]/members/[username]/profile/edit/
To: http://[website-url]/members/[username]/
Any thoughts on how to accomplish this?
I solved the problem with the following code:
<?php $classes = get_body_class();
if (in_array('profile-edit',$classes)) {
wp_redirect( bp_loggedin_user_domain() ); exit;
};
?>
This code calls the class of the body. If the body class has 'profile-edit' in it then the wp_redirect function is called. This function asks for the url of the BuddyPress loggedin user profile page and sent him to that page.