简体   繁体   中英

Redirect the edit profile page of Buddypress

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM