Mephisto - highlight admin comments
When comments are added to an article, it's nice to be able to reply as the article author and for the reader to know that it is actually the author replying.
This simple code change ensures that any author comments are shown differently from guest comments
We need to change one of line of code in the Mephisto install and then change one line in the comments.liquid file via the Mephisto Admin Area.
Start off by logging into your VPS and navigating to the mephisto directory:
cd ~/public_html/railsdomain.com/
Once there, edit 'app/controllers/mephisto_controller.rb':
nano app/controllers/mephisto_controller.rb
The first 4 lines will look like this:
class MephistoController < ApplicationController
layout nil
session :off
caches_page_with_references :dispatch
Change the third line so it now reads:
class MephistoController < ApplicationController
layout nil
session :new_session => false
caches_page_with_references :dispatch
Save the file and log out of your VPS and log into the Mephisto Admin Area.
Once there, click the 'Design' tab and then the _comments.liquid link.
Depending on the theme you are using, the liquid template may be named differently such as _article_comments.liquid, but it will contain the comments html layout.
Again, depending on your theme, the layout may be slightly different but locate the lines:
{% for comment in article.comments %}
<li class="{% cycle 'alt', '' %}" id="comment-{{ comment.id }}">
Change the 'li' line to read:
{% for comment in article.comments %}
<li class="comment {{ comment.presentation_class }}" id="comment-{{ comment.id }}">
Now restart the server. If you are using Litespeed:
sudo /usr/local/lsws/bin/lswsctrl restart
Once done, when you reply to a comment on your Mephisto site, log into the admin area first so Mephisto knows it's you and then add a comment in the normal way
The changes above ensure your comment is classed as 'by-author' and normal comments are classed as 'by-guest'.
How you then adjust your CSS is up to you. As you can see below, guest comments are in a white bubble and the author comments are in a shaded bubble.
That's it. Two lines of code to change and as mild or as wacky a CSS entry as you like.
To show the highlight effect I have entered two comments below. The first from a guest and the reply from the author.
PickledOnion
Digg it |
del.icio.us |
reddit |
StumbleUpon

Subscribe to Feed
Article Comments:
Guest User 27 May, 2007
The 'Guest User' name is not highlighted
PickledOnion 27 May, 2007
But the author's name is highlighted - so you know it's me and not an imposter!