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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何從個(gè)人資料頁(yè)面獲取用戶 ID 并在短代碼中插入 id=

如何從個(gè)人資料頁(yè)面獲取用戶 ID 并在短代碼中插入 id=

PHP
紅顏莎娜 2023-05-26 09:28:32
我正在做一個(gè)令人沮喪的項(xiàng)目,需要幫助。我需要從正在查看的配置文件頁(yè)面獲取 $user_id,并將該值插入簡(jiǎn)碼的 id = "_" $atts 字段。我正在使用終極會(huì)員作為我的會(huì)員插件。我需要將 $user_id 插入的短代碼如下...echo do_shortcode( '[aiovg_user_videos id=" '.$user_id.' "]' ); }短代碼將進(jìn)入名為“視頻”的個(gè)人資料選項(xiàng)卡,該選項(xiàng)卡將包含用戶上傳和導(dǎo)入的視頻。到目前為止我想出的,雖然它沒(méi)有工作如下......add_filter('um_profile_tabs', 'videos_tab', 1000 );function videos_tab( $tabs ) {    $tabs['videos'] = array(        'name' => 'Videos',        'icon' => 'um-icon-ios-videocam',        'custom' => true    );      return $tabs;}/* Tell the tab what to display */// If is current user's profile (profile.php)if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE ) {    $user_id = get_current_user_id();// If is another user's profile page} elseif (! empty($_GET['user_id']) && is_numeric($_GET['user_id']) ) {    $user_id = $_GET['user_id'];echo do_shortcode( "[aiovg_user_videos id=" . $user_id . "]" ); }我不是編碼員,但我正在學(xué)習(xí),所以我真的不知道我還需要什么才能實(shí)現(xiàn)這一目標(biāo)。我已經(jīng)嘗試了很多讓我錯(cuò)誤的事情。簡(jiǎn)而言之,我想讓短代碼從正在查看的用戶配置文件中獲取用戶 ID,這樣我就可以顯示帶有自動(dòng)填充 ID 的短代碼。
查看完整描述

2 回答

?
ITMISS

TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超8個(gè)贊

所以它可能就像這樣簡(jiǎn)單:


//very close to your initial code

add_filter( 'um_profile_tabs', 'um_videos_tab', 1000 );


function um_videos_tab( $tabs ) {

    $tabs['videos'] = array(

        'name' => 'Videos',

        'icon' => 'um-icon-ios-videocam',

        'custom' => true

    ) ;  


    return $tabs ;


}


//profile tab content

//based on how it appears UM has set up its action hooks

add_action( 'um_profile_content_videos', 'um_profile_content_videos' ) ;


function um_profile_content_videos() {


   //got to watch the apostrophes vs quotes so things don't get mixed up

   echo do_shortcode( ' [aiovg_user_videos id="' . um_profile_id() . '"] ' ) ; 


}

我的不確定性部分基于這樣一個(gè)事實(shí),即我既沒(méi)有 UM 也沒(méi)有生成 aiovg_user_videos 短代碼的任何東西,因此無(wú)法測(cè)試或調(diào)試??紤]到我有點(diǎn)盲目,在詳細(xì)研究 UM 代碼之前,我的下一次嘗試是_default在語(yǔ)句中添加“標(biāo)記”和“處理程序” add_action——add_action( 'um_profile_content_videos_default', 'um_profile_content_videos_default' ) ;以防萬(wàn)一這是對(duì)這些掛鉤的要求。


查看完整回答
反對(duì) 回復(fù) 2023-05-26
?
揚(yáng)帆大魚(yú)

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊

我終于弄明白了!??!這就是最終起作用的!


/**

 * Add a new Profile tab

 * @param array $tabs

 * @return array

 */

function um_videos_add_tab( $tabs ) {


    $tabs[ 'videos' ] = array(

        'name'   => 'Videos',

        'icon'   => 'um-icon-ios-videocam',

        'custom' => true

    );


    UM()->options()->options[ 'profile_tab_' . 'videos' ] = true;


    return $tabs;

}

add_filter( 'um_profile_tabs', 'um_videos_add_tab', 1000 );


/**

 * Render tab content

 * @param array $args

 */

function um_profile_content_videos_default( $args ) {

    /* START. You can paste your content here, it's just an example. */


    $action = 'videos';


$member_user_id = um_get_requested_user();

echo do_shortcode( "[aiovg_user_videos id=" . $member_user_id . "]" );



    /* END. You can paste your content here, it's just an example. */

}

add_action( 'um_profile_content_videos_default', 'um_profile_content_videos_default' );



查看完整回答
反對(duì) 回復(fù) 2023-05-26
  • 2 回答
  • 0 關(guān)注
  • 128 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

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