ConversationModel::clear PHP Метод

clear() публичный Метод

Clear a conversation for a specific user id.
С версии: 2.0.0
public clear ( integer $ConversationID, integer $ClearingUserID )
$ConversationID integer Unique ID of conversation effected.
$ClearingUserID integer Unique ID of current user.
    public function clear($ConversationID, $ClearingUserID)
    {
        $this->SQL->update('UserConversation')->set('Deleted', 1)->set('DateLastViewed', Gdn_Format::toDateTime())->where('UserID', $ClearingUserID)->where('ConversationID', $ConversationID)->put();
        $this->countUnread($ClearingUserID);
        $this->updateParticipantCount($ConversationID);
    }

Usage Example

Пример #1
0
 /**
  * Clear the message history for a specific conversation & user.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $ConversationID Unique ID of conversation to clear.
  */
 public function clear($ConversationID = false, $TransientKey = '')
 {
     $Session = Gdn::session();
     // Yes/No response
     $this->_DeliveryType = DELIVERY_TYPE_BOOL;
     $ValidID = is_numeric($ConversationID) && $ConversationID > 0;
     $ValidSession = $Session->UserID > 0 && $Session->validateTransientKey($TransientKey);
     if ($ValidID && $ValidSession) {
         // Clear it
         $this->ConversationModel->clear($ConversationID, $Session->UserID);
         $this->informMessage(t('The conversation has been cleared.'));
         $this->RedirectUrl = url('/messages/all');
     }
     $this->render();
 }
All Usage Examples Of ConversationModel::clear