BP_Messages_Message:: get_existing_thread (数组recipient_ids美元,整数美元的发送者)
获取与收件人匹配的现有线程
描述
参数
- recipient_ids美元
-
(数组)(必需)
- 美元的发送者
-
(整数)(必需)
源
文件:bp-messages /类/ class-bp-messages-message.php
Public static function get_existing_thread($recipient_ids, $sender = 0) {global $wpdb;英国石油美元= buddypress ();$recipient_ids[] = $sender; //将发送者添加到接收人列表中,并按id升序排序$ recipient_ids = array_filter (array_unique(元素(recipient_ids美元)));排序($ recipient_ids);$result = $wpdb->get_results($sql = $wpdb->准备("SELECT r.thread_id as thread_id, GROUP_CONCAT(DISTINCT user_id ORDER BY user_id separator ',') as recipient_list ",MAX(m.date_sent) AS date_sent FROM {$bp->messages-> table_name_users} r INNER JOIN {$bp->messages->table_name_messages} m ON m.thread_id = r.thread_id GROUP BY r.thread_id HAVING recipient_list = %s ORDER BY date_sent DESC LIMIT 1 ", implode(',', $recipient_ids));如果(!$results){返回null;} $thread_id = $results[0]->thread_id; if ( ! $is_active_recipient = BP_Messages_Thread::is_thread_recipient( $thread_id, $sender ) ) { return null; } return $thread_id; }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.0.0 | 介绍了。 |