Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Read-All PMs?

Is there any way to implement a read-all PMs button on Vanillaforums? I have gotten complaints from users about that and have been wondering this for a while now. Thanks in advance.


  • Options


  • Options
    hgtonighthgtonight ∞ · New MVP
    edited January 2015
    public function messagesController_markAllRead_create($Sender) {
      $UserID = $this->Request->Get('userid', Gdn::Session()->UserID);
      if ($UserID != Gdn::Session()->UserID) {
        if (!C('Conversations.Moderation.Allow', FALSE)) {
          throw PermissionException();
    public function conversationModel_markAllRead_create($Sender) {
      $UserID = val(0,$Sender->EventArguments, FALSE);
      if(is_numeric($UserID)) {
        // Update the the read conversation count for the user.
        $Sender->SQL->Update('UserConversation uc')
             ->Set('uc.CountReadMessages', 'c.CountMessages', FALSE)
             ->Set('uc.DateLastViewed', Gdn_Format::ToDateTime())
             ->Set('uc.LastMessageID', 'c.LastMessageID', FALSE)
             ->Where('uc.UserID', $UserID)
        $Usermodel = new UserModel();
        $Usermodel->SetField($UserID, 'CountUnreadConversations', 0);

    Slap that in a plugin and spit out a link to

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.