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.

[2.2.4] Need some help replacing 'new' comment counter

ZhaanZhaan Professional fool ✭✭
edited January 2014 in Vanilla 2.0 - 2.8

Hi again, VF! So, I want to replace the "x new" comment counter with an icon (font awesome, probably).. but I haven't figured out how to do it yet. I think it's somewhere in views/discussions/.

Just to be clear, I'm only talking about the "NEW" comment counter, and not the one for total comments.

Could you give me some directions?

Thanks!

Best Answer

  • hgtonighthgtonight ∞ · New Moderator
    Answer ✓

    You could either override the NewComments() function in /applications/vanilla/views/discussions/helper_functions.php to display your icon.

    Or you could use some locale definitions for '%s new' and '%s new plural' like so:

    $Definition['%s new'] = '<span class="IconClass">&nbsp;<span>';
    $Definition['%s new plural'] = '<span class="IconClass">&nbsp;<span>';
    

    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.

Answers

  • hgtonighthgtonight ∞ · New Moderator
    Answer ✓

    You could either override the NewComments() function in /applications/vanilla/views/discussions/helper_functions.php to display your icon.

    Or you could use some locale definitions for '%s new' and '%s new plural' like so:

    $Definition['%s new'] = '<span class="IconClass">&nbsp;<span>';
    $Definition['%s new plural'] = '<span class="IconClass">&nbsp;<span>';
    

    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.

  • ZhaanZhaan Professional fool ✭✭

    Thanks, I'll try both.

  • ZhaanZhaan Professional fool ✭✭
    edited January 2014

    Your suggestions worked perfectly, but I'd like to move the icon all the way to the left as well, right next to the discussion titles. Any clue how to do that?

    I don't know much PHP so I'm not sure how to do this.

  • peregrineperegrine MVP
    edited January 2014

    Your suggestions worked perfectly

    perhaps if you post what you did. both or either or.

    float the class and tag and/or use positioning on the class tag in your css.
    http://www.w3schools.com/css/css_float.asp
    http://www.w3schools.com/css/css_positioning.asp
    http://alistapart.com/article/css-positioning-101

    or hide the originals. and create a plugin to display the icons on a different trigger event.

    see wiki for events.

    or get @vrijvlinder to make a house call. :)

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

  • ZhaanZhaan Professional fool ✭✭

    I used helper_functions.php, but setting css float to left doesn't seem to do anything. How can I move the 'new' part out of the meta area entirely?

  • peregrineperegrine MVP
    edited January 2014

    I don't know your theme or the tag you are trying to identify. but as an example

        .Meta-Discussion .HasNew {
         position: relative;
         left: -50px;
         display:inline-block;
        }
    

    and these definitions may apply as well

    $Definition['new discussion'] = "";
    $Definition['new'] = "";
    

    or e.g.

    $Definition['new discussion'] = "&#xf0ac;";
    $Definition['new'] = "&#xf0ac;";
    

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

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    in my theme this is the line I used to move that. This only serves as an example, as peregrine says, I don't have a way of testing this unless I have a link to see it.

    ul.DataList div.Meta strong {
    position: absolute;
    top: 44px;
    left: -635px;
    white-space: nowrap;
    }
    
Sign In or Register to comment.