bp_activity_at_message_notification ($ activity_id.receiver_user_id美元

当用户在更新中被提及时,发送电子邮件和BP通知。

描述

参数

$ activity_id.

(必需)活动更新的ID。

receiver_user_id美元

(必需)接收更新的用户的ID。

文件:bp-activity / bp-activity-functions.php

函数bp_activity_at_message_notification($activity_id, $receiver_user_id) {$notifications = BP_Core_Notification::get_all_for_user($receiver_user_id, '所有');//不要为同一个活动项留下多个通知。Foreach ($notifications as $notification) {if ($activity_id == $notification->item_id) {return;}} $activity = new BP_Activity_Activity($activity_id);美元email_type =“activity-at-message”;group_name = "美元;$message_link = bp_activity_get_permalink($activity_id);$poster_name = bp_core_get_user_displayname($activity->user_id);Remove_filter ('bp_get_activity_content_body', 'convert_smilies');Remove_filter ('bp_get_activity_content_body', 'wpautop'); remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); /** This filter is documented in bp-activity/bp-activity-template.php */ $content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $activity->content, &$activity ) ); add_filter( 'bp_get_activity_content_body', 'convert_smilies' ); add_filter( 'bp_get_activity_content_body', 'wpautop' ); add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); // Now email the user with the contents of the message (if they have enabled email notifications). if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) { if ( bp_is_active( 'groups' ) && bp_is_group() ) { $email_type = 'groups-at-message'; $group_name = bp_get_current_group_name(); } $unsubscribe_args = array( 'user_id' => $receiver_user_id, 'notification_type' => $email_type, ); $args = array( 'tokens' => array( 'activity' => $activity, 'usermessage' => wp_strip_all_tags( $content ), 'group.name' => $group_name, 'mentioned.url' => $message_link, 'poster.name' => $poster_name, 'receiver-user.id' => $receiver_user_id, 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), ), ); bp_send_email( $email_type, $receiver_user_id, $args ); } /** * Fires after the sending of an @mention email notification. * * @since BuddyPress 1.5.0 * @since BuddyPress 2.5.0 $subject, $message, $content arguments unset and deprecated. * * @param BP_Activity_Activity $activity Activity Item object. * @param string $deprecated Removed in 2.5; now an empty string. * @param string $deprecated Removed in 2.5; now an empty string. * @param string $deprecated Removed in 2.5; now an empty string. * @param int $receiver_user_id The ID of the user who is receiving the update. */ do_action( 'bp_activity_sent_mention_email', $activity, '', '', '', $receiver_user_id ); }

更新日志

更新日志
版本 描述
BuddyPress 1.2.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队