bp_group_messages_groups_membership_accepted($ user_id.那$ group_id.那$接受的)
当某人在组中接受某人时,将新消息添加到现有组线程。
描述
参数
- $ user_id.
-
(必需的)
- $ group_id.
-
(必需的)
- $接受
-
(必需的)
来源
文件:bp-messages / bp-messages-filters.php
函数bp_group_messages_groups_membership_accepted($ user_id,$ group_id,$ accepted){global $ wpdb,$ bp,$ messages_template;$ group_thread =(int)groups_get_groupmeta((int)$ group_id,'group_message_thread');if($ 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 = explode(',',$ message_users_ids);array_push($ message_users_ids,$ user_id);$ group_name = bp_get_group_name(组_get_group($ group_id));$ text = sprintf(__('加入“%s”','buddyboss'),$ group_name);bp_messages_update_meta($ first_message-> id,'message_users_id',moplode(',',$ message_users_ids)));$ wpdb->查询($ wpdb->准备(“插入{$ bp-> messages-> table_name_recipes}(user_id,thread_id,Unrey_count)值(%d,%d,0)”,$ user_id,$ group_thread) ); 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( 'thread_id' => $group_thread, 'sender_id' => $user_id, '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_joined', 'yes' ); bp_messages_update_meta( $last_message_id, 'group_id', $group_id ); } } } } }
变更乐
版本 | 描述 |
---|---|
Buddyboss 1.2.9 | 介绍。 |