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.
Options

Unfollow Category

I've just exported a Vanilla 1 forum (which has been quietly humming along since 2006!) to a brand-new Vanilla 2 install.

Everything is working well, except for 'unfollow category'. Posts from unfollowed categories are still shown in the 'all discussions' list.

How can I allow users to opt out of routinely viewing posts in a category, while making it possible for them to view them if they need to?

Comments

  • Options
    hgtonighthgtonight ∞ · New MVP

    As far as I know, the category follow/unfollow feature is only respected on the Categories controller. The discussions controller (using the discussion model) doesn't take the follow/unfollow preferences into account when retrieving the page list.

    You could of course modify this behavior via a plugin. Something like the below should get you started:

    public function DiscussionModel_BeforeGet_Handler($Sender) {
      $Session = Gdn::Session();
      if($Session->IsValid()) {
        $Sender->SQL->Select('uc.Unfollow')->Join('UserCategory uc', 'd.CategoryID = uc.CategoryID and uc.UserID = ' . $Session->UserID, 'left')->Where('uc.Unfollow != 1');
      }
    }
    

    This is untested, but shouldn't destroy anything if it doesn't work.

    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.