通过BuddyPress中的线程ID发送回复消息

时间:2017-06-16 作者:Gnanasekaran Loganathan

如何通过pro-grammaticly使用现有消息会话的线程ID发送回复消息。

例如,username1与username2进行对话。现在需要发送回复现有对话。

1 个回复
SO网友:Gnanasekaran Loganathan

获取用户现有对话的线程id或不创建新对话,

  $threadId = buddydev_get_threads_between_users($sender_id, $recip_id );

    if(empty($threadId)){
       if ( $thread_id = messages_new_message( array(\'sender_id\' => $sender_id, \'subject\' => $subject, \'content\' => $message, \'recipients\' => $recip_id ) ) ) {
        bp_core_add_message( __(\'Message was sent.\', \'buddypress\' ) );
        } else {
        bp_core_add_message( __( \'There was an error sending Message.\', \'buddypress\' ), \'error\' );
        }
    }
    else{
      if ( messages_new_message( array(\'sender_id\' => $sender_id, \'thread_id\' => $threadId[0], \'subject\' => $subject, \'content\' => $message, \'recipients\' => $recip_id ) ) ) {
        bp_core_add_message( __(\'Message was sent.\', \'buddypress\' ) );
        bp_core_redirect( $bp->displayed_user->domain ); // adjust as needed
        } else {
        bp_core_add_message( __( \'There was an error sending Message.\', \'buddypress\' ), \'error\' );
        }
    }

结束

相关推荐

帮助定制管理栏,从下拉菜单中删除BuddyPress链接

我正在尝试定制我的管理栏。我已经完成了我需要做的大部分事情,但在几件事情上我被卡住了。我想从您移动“你好,姓名?”时出现的下拉菜单中删除大部分链接。我想保留档案链接和图像的顶部,但想删除下面的所有链接。即活动、配置文件、通知、消息。我想在主页链接中使用字体图标,但没有显示,而是显示随机字符。有人知道为什么吗?我的代码如下://add home page link in top left adminbar - want to use font icon but its not working. ad