bp_group_messages_banned_member (user_id美元,group_id美元)
当有人被群禁时,添加新的消息到群里。
描述
参数
- user_id美元
-
(必需)
- group_id美元
-
(必需)
源
文件:bp-messages / bp-messages-filters.php
函数bp_group_messages_banned_member($user_id, $group_id) {global $wpdb, $bp, $messages_template;$group_thread = (int) group_get_groupmeta ((int) $group_id, 'group_message_thread');如果($group_thread > 0) {$first_message = BP_Messages_Thread::get_first_message($group_thread);$message_users_ids = bp_messages_get_meta($first_message->id, 'message_users_ids', true);//用户列表$message_users_ids =爆炸(',',$message_users_ids);$group_name = bp_get_group_name(group_get_group ($group_id));文本美元= sprintf(__(“左“% s”、“buddyboss”),group_name美元);If ($key = array_search($user_id, $message_users_ids)) !== false) {unset($message_users_ids[$key]);} bp_messages_update_meta($first_message->id, 'message_users_ids', implode(',', $message_users_ids));Remove_action ('messages_message_sent', 'messages_notification_new_message', 10); remove_action( 'messages_message_sent', 'bp_messages_message_sent_add_notification', 10 ); $new_reply = messages_new_message( array( 'sender_id' => $user_id, 'thread_id' => $group_thread, 'subject' => '', 'content' => '', 'date_sent' => $date_sent = bp_core_current_time(), 'error_type' => 'wp_error', ) ); add_action( 'messages_message_sent', 'messages_notification_new_message', 10 ); add_action( 'messages_message_sent', 'bp_messages_message_sent_add_notification', 10 ); if ( ! is_wp_error( $new_reply ) && true === is_int( ( int ) $new_reply ) ) { if ( bp_has_message_threads( array( 'include' => $new_reply ) ) ) { while ( bp_message_threads() ) { bp_message_thread(); $last_message_id = (int) $messages_template->thread->last_message_id; bp_messages_update_meta( $last_message_id, 'group_message_group_ban', 'yes' ); bp_messages_update_meta( $last_message_id, 'group_id', $group_id ); } } } $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND thread_id = %d", $user_id, (int) $group_thread ) ); } }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.2.9 | 介绍了。 |