正在查看 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 个帖子)
- 哎呀,回复话题必需登录。