示例#1
0
function messages_check_thread_access( $thread_id, $user_id = false ) {
	global $bp;

	if ( !$user_id )
		$user_id = $bp->loggedin_user->id;

	return BP_Messages_Thread::check_access( $thread_id, $user_id );
}
 /**
  * @group check_access
  */
 public function test_check_access_invalid_thread()
 {
     $this->assertEquals(null, BP_Messages_Thread::check_access(999, 1));
 }
function messages_check_thread_access($thread_id, $user_id = 0)
{
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    return BP_Messages_Thread::check_access($thread_id, $user_id);
}
示例#4
0
function messages_action_bulk_delete()
{
    global $bp, $thread_ids;
    if ($bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'bulk-delete') {
        return false;
    }
    $thread_ids = $_POST['thread_ids'];
    if (!$thread_ids || !BP_Messages_Thread::check_access($thread_ids)) {
        bp_core_redirect($bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action);
    } else {
        if (!messages_delete_thread($thread_ids)) {
            bp_core_add_message(__('There was an error deleting messages.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('Messages deleted.', 'buddypress'));
        }
        bp_core_redirect($bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);
    }
}
function messages_check_thread_access($thread_id, $user_id = 0)
{
    global $bp;
    if (empty($user_id)) {
        $user_id = $bp->loggedin_user->id;
    }
    return BP_Messages_Thread::check_access($thread_id, $user_id);
}