コード例 #1
0
ファイル: actions.php プロジェクト: socialray/surfied-2-0
 public function check_current_user()
 {
     if (!is_user_logged_in()) {
         return;
         //no need to process anymore
     }
     $user_id = get_current_user_id();
     bpchat_login_user($user_id);
     //it will solve the login issue
     bpchat_update_last_active($user_id);
     //update last active time for user
 }
コード例 #2
0
ファイル: bp-chat-ajax.php プロジェクト: Lady1178/bp-chat
 public function save_messages()
 {
     $new_message = new BP_Chat_Message();
     $new_message->message = esc_html($_POST['message']);
     $new_message->channel_id = absint($_POST['channel_id']);
     $new_message->sender_id = get_current_user_id();
     $new_message->save();
     // open this channel, we don't care anymore who are subscribed to this channel
     bpchat_update_all_channel_user($new_message->channel_id, 'open');
     //status of the channel
     //update senders last activity time
     bpchat_update_last_active($new_message->sender_id);
     //update last active time for sender
     echo json_encode(array('name' => bp_core_get_user_displayname(get_current_user_id()), 'id' => $new_message->id));
     exit(0);
 }
コード例 #3
0
ファイル: functions.php プロジェクト: Lady1178/bp-chat
/**
 * Mark a user online
 * 
 * @param type $user_id
 * @return type
 */
function bpchat_login_user($user_id)
{
    bpchat_update_last_active($user_id);
    //update last active time
    return bpchat_update_user_state($user_id, 'online');
    //may be we should remember the last state?
}