簡體   English   中英

將用戶配置文件字段添加到Wordpress Buddypress以包括“收藏夾”

[英]Adding User Profile Fields to Wordpress Buddypress to Include “Favorites”

我正在嘗試尋找一種方法讓Wordpress(Buddypress)網站上的成員選擇“喜歡的電影,書籍等”。

如果他們可以從系統中已有的書中進行選擇,並在將來添加更多內容,而不是簡單地輸入這些列表,這將是很好的選擇。

我希望對此有一個簡單的答案,例如可以使用或至少可以修改的插件。 有誰知道我可以研究的內容?

您的標題詢問如何添加用戶個人資料字段。 這是添加任意多個字段的代碼。 添加字段后,您可以輕松地在自定義選項卡頁面上放置其他輸入或選項,以使用戶輸入自己的收藏夾。

function my_test_setup_nav() {
global $bp; 
$parent_slug = ‘test’;
$child_slug = ‘test_sub’;
//name, slug, screen, position, default subnav
bp_core_new_nav_item( array(‘name’ => __( ‘Test’ ),’slug’ => $parent_slug,’screen_function’ => ‘my_profile_page_function_to_show_screen’,'position’ => 40,’default_subnav_slug’ => $child_slug ) );
/* Add the subnav items to the profile */
// name, slug, parent_url, parent slug, screen function
bp_core_new_subnav_item( array( ‘name’ => __( ‘Home’ ), ‘slug’ => $child_slug, ‘parent_url’ => $bp->loggedin_user->domain . $parent_slug.’/', ‘parent_slug’ => $parent_slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen’ ) );
bp_core_new_subnav_item( array( ‘name’ => __( ‘Random Page’ ), ‘slug’ => ‘random’, ‘parent_url’ => $bp->loggedin_user->domain . $parent_slug.’/', ‘parent_slug’ => $parent_slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen234′ ) );
}

function my_profile_page_function_to_show_screen() {

//add title and content here – last is to call the members plugin.php template
add_action( ‘bp_template_title’, ‘my_profile_page_function_to_show_screen_title’ );
add_action( ‘bp_template_content’, ‘my_profile_page_function_to_show_screen_content’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}

function my_profile_page_function_to_show_screen_title() {
echo ‘wptaskforce title’;
}

function my_profile_page_function_to_show_screen_content() {
echo ‘wptaskforce content’;
}


//random page content: 
function my_profile_page_function_to_show_screen234() {
//add content here – last is to call the members plugin.php template
add_action( ‘bp_template_content’, ‘my_profile_page_function_to_show_screen234_content’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}
function my_profile_page_function_to_show_screen234_content() {
echo ‘This is a random page.’;

} 
add_action( ‘bp_setup_nav’, ‘my_test_setup_nav’ );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM