messages_notification_new_message (数组| BP_Messages_Messageraw_args美元数组()

电子邮件通知收件人有新的未读的私人邮件。

描述

参数

raw_args美元

数组|BP_Messages_Message(可选)数组的参数。还接受一个BP_Messages_Message对象

默认值:数组()

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

Function messages_notification_new_message($raw_args = array()) {if (is_object($raw_args)) {$args = (array) $raw_args;} else {$args = $raw_args;} //这些应该在下面提取。接受美元= array ();$email_subject = $email_content = ";美元sender_id = 0;/ /呕吐。提取(args);If(空($接收者)){返回;} $sender_name = bp_core_get_user_displayname($sender_id); if ( isset( $message ) ) { $message = wpautop( $message ); } else { $message = ''; } // Send an email to each recipient. foreach ( $recipients as $recipient ) { if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) { continue; } // User data and links. $ud = get_userdata( $recipient->user_id ); if ( empty( $ud ) ) { continue; } $unsubscribe_args = array( 'user_id' => $recipient->user_id, 'notification_type' => 'messages-unread', ); bp_send_email( 'messages-unread', $ud, array( 'tokens' => array( 'message_id' => $id, 'usermessage' => stripslashes( $message ), 'message.url' => esc_url( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/view/' . $thread_id . '/' ), 'sender.name' => $sender_name, 'usersubject' => sanitize_text_field( stripslashes( $subject ) ), 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), ), ) ); } /** * Fires after the sending of a new message email notification. * * @since BuddyPress 1.5.0 * @deprecated 2.5.0 Use the filters in BP_Email. * $email_subject and $email_content arguments unset and deprecated. * * @param array $recipients User IDs of recipients. * @param string $email_subject Deprecated in 2.5; now an empty string. * @param string $email_content Deprecated in 2.5; now an empty string. * @param array $args Array of originally provided arguments. */ do_action( 'bp_messages_sent_notification_email', $recipients, '', '', $args ); }

更新日志

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

问题吗?

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