Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

CODE CHANGE SUGGESTION: All Discussions appear of class Unread for guest users

mdrmdr
edited June 2010 in Vanilla 1.0 Help
Hello All,
Brand new here and new to Vanilla 1, I'm really liking it so far though, I got sick of the way that styling unread discussions would apply to all threads for guest users, since they do not have an active session with which to check to see that they had in fact read the discussion. This is annoying when you're trying to do a green background for all discussions with new comments:

#Discussions li.Unread.NewComments ul,#Discussions li.Read.NewComments ul{ background: #e0f0d0 url(new.png) no-repeat left bottom; }

This would result in all discussions for a guest user to appear green with my nifty little new logo under the title.

#Discussions li.NoReplies ul,#Discussions li.Read.NewComments ul{ background: #e0f0d0 url(new.png) no-repeat left bottom; }

This is another idea that I played with, this got rid of the above problem but presented another, if, while the user was absent, a new post appeared and then somebody replied to it, it was classified as "Unread & NewComments".

SO, I decided another class was necessary for discussions based upon whether the user had an active session. . . easy enough

Going into the "discussion.php" file under the "/themes/" folder, I crammed some code right smack dab into the middle of line 14 so that this:

<li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($Alternate ? ' Alternate' : '').'">';

Became this:
<li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($this->Context->Session->UserID > 0 ? ' ActiveSession' : '').($Alternate ? ' Alternate' : '').'">';

And then I was able to change the CSS to this:
#Discussions li.NoReplies ul,#Discussions li.ActiveSession.NewComments ul{ background: #e0f0d0 url(new.png) no-repeat left bottom; }

The "ActiveSession" class saves my ass and everything isn't annoying for perspective users. Instead of ALL threads being marked new, only posts that have NoReplies are styled new for the guest user.

This should probably be in the main release, it would make me happy at least. Until such time it will go into the theme I'm intending on posting here once complete.

Your Humble Servant,
mdr
Sign In or Register to comment.