第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在登錄到 WordPress 中的 BuddyPress 個人資料后重定向

如何在登錄到 WordPress 中的 BuddyPress 個人資料后重定向

PHP
qq_笑_17 2021-06-08 17:47:13
我使用 BuddyPress 插件運行 WordPress 5.1.1。基本上我想要做的是,將用戶從自定義登錄鏈接重定向到他們在 BuddyPress 中的個人資料頁面。我已經(jīng)閱讀并檢查了 Stackoverflow 上為我的類似查詢提供的幾乎所有代碼,但沒有人在我的網(wǎng)站上工作過。唯一的代碼在下面起作用,但它對我的站點設置和設置有一個問題。function bp_help_redirect_to_profile(){  global $bp;  if( is_user_logged_in() && is_front_page() ) {   bp_core_redirect( get_option('home') . '/members/' .    bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );  }}add_action( 'get_header', 'bp_help_redirect_to_profile',1);問題是,當我想在網(wǎng)站主頁上重定向時,它一直在 BuddyPress 個人資料上重定向我。類別和帖子部分正在正確加載。所以,我需要的是,當?shù)卿浟髦囟ㄏ蛴脩粼谒麄兊?BuddyPress 個人資料頁面上時,在用戶點擊網(wǎng)站主頁加載網(wǎng)站主頁后,而不是 BuddyPress。我希望有人能以這種方式幫助和調(diào)整功能。
查看完整描述

2 回答

?
臨摹微笑

TA貢獻1982條經(jīng)驗 獲得超2個贊

add_filter( 'bp_login_redirect', 'bpdev_redirect_to_profile', 11, 3 );


function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user )

{


  if( empty( $redirect_to_calculated ) )

    $redirect_to_calculated = admin_url();


    //if the user is not site admin,redirect to his/her profile


if( isset( $user->ID) && ! is_super_admin( $user->ID ) )

    return bp_core_get_user_domain( $user->ID );

else

    return $redirect_to_calculated; /*if site admin or not logged in,do not do 

    anything much*/


}

測試代碼放入您的活動主題功能文件中


查看完整回答
反對 回復 2021-06-13
  • 2 回答
  • 0 關(guān)注
  • 249 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號