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.

Display Unread Post+Comment Count instead of Total Comment Count in category sidebar?

edited August 2015 in Vanilla 2.0 - 2.8

Instead of listing the number of posts/comments next to the category names in the sidebar (not super useful for active users imo), I'd rather display the number of unread posts+comments for the user. I tried looking through the $Category object in categories.php but it doesn't seem to have the info I want. Any help?

Comments

  • peregrineperegrine MVP
    edited August 2015

    iirc it doesn't keep track of unread post/comments on a per-category basis

    it would be a major performance killer I would think to try to track this on a category basis.

    from what I seem to recall it was all calculated from the userdiscussion table.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited August 2015

    A bit of a bummer UX wise, but if that's the case is there at least a way to find out if a category has unread content? I'd at least be able to visually differentiate categories with new content.

  • peregrineperegrine MVP
    edited August 2015

    but if that's the case is there at least a way to find out if a category has unread content?

    if you look at categories controller - categories page.

    you can see categories have a css class read or unread.

    you would need to retrieve that and apply that to the category box panel somehow.

    you would need to change the css

    .PanelCategories .Read {
      background-color: red!important  
    }
    

    clone the module write plugin - might be a better way than this. but its an idea.

    https://github.com/vanilla/vanilla/blob/release/2.1/applications/vanilla/views/modules/categories.php#L30

    add a line like this below in cloned module.

     if ($Category->Read) $CssClass = $CssClass . " Read ";
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited August 2015

    you could copy the categories.php

    to

    yourtheme/views/modules/categories.php

    and change

    echo Anchor(htmlspecialchars($Category->Name).$CountText, CategoryUrl($Category), 'ItemLink');

    to

     if (!$Category->Read) { 
             $CountText = '<strong class="HasNew Aside" title="new comments since you last read this.">New</strong>';
             }
             echo Anchor(htmlspecialchars($Category->Name).$CountText, CategoryUrl($Category), 'ItemLink');
    

    HasNew should alread have some css setup.

    you said you didn't want counts and wanted "New"

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Awesome! Thanks @peregrine I'll give this a shot!

Sign In or Register to comment.