public function joinAsMember($id) { if (!self::checkRequest($id)) { DB::insert('group_user', array('user_id' => Session::get('user_id'), 'group_id' => $id, 'type' => 'M', 'time' => time())); Notif::raiseNotif($id, 'GR'); return TRUE; } return FALSE; }
public function request($post) { $user_id = User::getPublicUserId($post['username']); if ($user_id === Session::get('user_id')) { return 'Sorry you cannot Request to your own profile'; } else { $follow_id = DB::fetch(array('request' => 'request_id'), array('user_id' => Session::get('user_id'), 'other_user_id' => $user_id)); if (empty($follow_id)) { DB::insert('request', array('user_id' => Session::get('user_id'), 'other_user_id' => $user_id, 'type' => $post['type'], 'time' => time())); Notif::raiseNotif($user_id, 'R' . $post['type']); return TRUE; } else { return 'Request already sent'; } } }