正在檢視 3 個帖子:1-3 (共 3 個帖子)
-
作者帖子
-
因為我們的是支援論壇,所以使用者間的互動並不是很強,但還是可以慢慢的進行改進的,下面是給 bbPress 新增 @使用者名稱的功能:
/** * Add @mentionname after bbpress forum author details */ add_action( 'bbp_theme_after_reply_author_details', 'mentionname_to_bbpress' ); function mentionname_to_bbpress () { $user = get_userdata( bbp_get_reply_author_id() ); if ( !empty( $user->user_nicename ) ) { $user_nicename = $user->user_nicename; echo "@".$user_nicename; } }
新增到你的主題或者子主題的 functions.php 檔案底部即可。
剛開始想的是透過 bbPress @ 使用者來實現讓被 @ 的使用者接收電子郵件通知,但發現好像行不通,同時就算是行得通可能也會造成對使用者的騷擾行為,但還是找到了解決方案:
@ 並進行郵件通知還並不是 bbPress 的夠功能。但現在你可以使用 BuddyPress 提供的 @ 功能,並使用此程式碼在論壇上使用。
將其複製到您的子主題 functions.php 或使用功能外掛。
function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) { if ( function_exists( 'bbpress' ) && is_bbpress() ) { $retval = true; } return $retval; } add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
我想你會得到隨時隨地的 BuddyPress 的電子郵件通知您得到
對於多個使用者,您可以將其與空間分開。
-
作者帖子
正在檢視 3 個帖子:1-3 (共 3 個帖子)
- 哎呀,回覆話題必需登入。