コード例 #1
0
 /**
  * Signes the user out of the event
  * Returns TRUE on success, FALSE otherwise
  * 
  * @global wpdb $wpdb
  * @param int $userID
  * @param int $eventID
  * @return boolean
  */
 public static function signOut($userID, $eventID)
 {
     global $wpdb;
     $query = "UPDATE `datr_User_has_Events` \n                SET sign_out_datetime = NOW(), status = 'signed_out'\n                WHERE userID = {$userID} AND eventID = {$eventID}";
     if (!$wpdb->query($query)) {
         return false;
     }
     $event = EventDatabaseManager::getEvent($eventID);
     $topicID = $event->getTopicID();
     if (EventDatabaseManager::removeCurrentEvent($userID, $topicID)) {
         return EventDatabaseManager::decrementParticipantsNum($eventID);
     }
 }