正在查看 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 個帖子)
- 哎呀,回覆話題必需登錄。