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

How to show announcements in 'Unread Discussions' page

AaronWebsteyAaronWebstey Headband AfficionadoCole Harbour, NS ✭✭✭

I use http://myforumname.com/discussions/unread quite a bit, and have added a link to it in my theme (and in the panel; I have another discussion about that). It bugged me that announcements are not included, so I added them.

On 2.1.8p2, I edited the following files:

applications/vanilla/models/class.discussionmodel.php

402a403
        ->Select('d.Announce', '', 'IsAnnounce')
424c425
<       $this->EventArguments['SortField'] = C('Vanilla.Discussions.SortField', 'd.DateLastComment');
---
  $this->EventArguments['SortField'] = C('Vanilla.Discussions.SortField', 'IsAnnounce desc, d.DateLastComment');

applications/vanilla/controllers/class.discussionscontroller.php (note the 's'! NOT discussioncontroller!):

228c228
<       $this->DiscussionData = $DiscussionModel->GetUnread($Page, $Limit);
---
  $this->DiscussionData = $DiscussionModel->GetUnread($Page, $Limit, array('Announce' => 'all'));

This did it for me - Announcements now show up in my 'unread' list!

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I challenge you to do this without a core modification.

    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.

  • Options
    AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    Challenge accepted! Do you think it's possible, and I just need to figure it out? Or are you wondering if it's possible too :)

  • Options
    hgtonighthgtonight ∞ · New Moderator

    Anything is possible when you realize you can replace models, controller, and views.

    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.

  • Options
    AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    Thanks. I'll stop asking questions, or it won't be a real challenge now will it? And if anything is possible, I'm going to make a plugin that will brew me a beer and serve it in a frosty mug with pretzels.

  • Options
    LincLinc Detroit Admin

    @AaronWebstey Per our other discussion, I'd actually be fine with this being the default behavior, but I think the challenge should be to refactor Unread out of core to an addon in the Addons repo. :) I've confirmed with @Todd that we wanna get this out.

  • Options
    AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    @Linc‌ I was just thinking about how to do this on the way home :). Now that's a challenge!

  • Options
    AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    PS challenge still accepted.

  • Options
    LincLinc Detroit Admin

    You'll want to make sure you include this too: https://github.com/vanilla/vanilla/pull/2368

Sign In or Register to comment.