/**
  * Signs a user for the event
  * A user must posess the necessary access rights (see comment for the getAvailableEventsForUser function)
  * Returns TRUE on success, FALSE otherwise
  * 
  * @param int $userID
  * @param int $eventID
  * @return boolean
  */
 public static function signIn($userID, $eventID)
 {
     global $wpdb;
     if (EventDatabaseManager::canParticipate($userID, $eventID)) {
         $query = "INSERT INTO `datr_User_has_Events` \n                (`userID`, `eventID`, `sign_in_datetime`, `sign_out_datetime`, `completion_date`, status) \n                VALUES ({$userID}, {$eventID}, NOW(), NULL, NULL, 'signed_in')\n                    ON DUPLICATE KEY UPDATE sign_in_datetime = NOW(), status = 'signed_in';";
         if (!$wpdb->query($query)) {
             return false;
         }
         $event = EventDatabaseManager::getEvent($eventID);
         $topicID = $event->getTopicID();
         if (EventDatabaseManager::isCurrentEventCompleted($userID, $topicID)) {
             $currentEventID = EventDatabaseManager::getCurrentEventID($userID, $topicID);
             if (!EventDatabaseManager::setLastEvent($userID, $currentEventID)) {
                 return false;
             }
         }
         if (EventDatabaseManager::setCurrentEvent($userID, $eventID) === false) {
             return false;
         } else {
             return EventDatabaseManager::incrementParticipantsNum($eventID);
         }
     }
     return false;
 }