我的客户在他的Wordpress网站上使用 Buddypress ,但他不希望用户在 Buddypress 中编辑他们的个人资料。
他也不希望用户在点击管理栏时转到他们的/profile/edit
页面。
因此,我正在寻找一种方法将de adminbar中的网址更改为个人资料视图页面,或者将profile/edit
页面重定向到个人资料视图页面。
所以来自:http://[website-url]/members/[username]/profile/edit/
收件人:http://[website-url]/members/[username]/
关于如何做到这一点的任何想法?
答案 0 :(得分:0)
我用以下代码解决了这个问题:
<?php $classes = get_body_class();
if (in_array('profile-edit',$classes)) {
wp_redirect( bp_loggedin_user_domain() ); exit;
};
?>
此代码调用正文的类。如果body类中包含'profile-edit',则调用wp_redirect函数。此函数请求BuddyPress登录用户个人资料页面的网址并将其发送到该页面。