Way to indicate comments made by (logged in) user/admin

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Pedahzur
Regular
Posts: 10
Joined: Sat Feb 17, 2007 6:19 am
Contact:

Way to indicate comments made by (logged in) user/admin

Post by Pedahzur » Sun Aug 17, 2008 10:18 pm

As s9y is configured by default, anyone could claim to be the author of the blog post in a comment. Is there a way to configure s9y to indicate a comment made by a logged in user? Something like a slightly different background, a line at the top of the post, or something? It'd be nice if readers knew the comment made was "authoritative."

User avatar
robi-bobi
Regular
Posts: 40
Joined: Mon Nov 21, 2005 1:40 pm
Location: Bulgaria
Contact:

Post by robi-bobi » Mon Aug 18, 2008 10:19 am

http://blog.robi-bobi.net/archives/242- ... mment.html
(design is a little broken - under reconstruction, don't pay attention)

I suggest you to use css class serendipity_comment_author_self - which should do what you want, but I am not sure when this class is applied
1) when the names match the author
2) when the author is logged and commented

2 - would be what you want, but 1 is still ok, if you do comments moderation (as I do)
I don't have time to check it now, you can take a look at template files

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers » Mon Aug 18, 2008 4:37 pm

If your template does not have a comments.tpl smarty file, it will use the one from /templates/default/. As robi-bobi pointed out, that smarty file will add the class of serendipity_comment_author_self to comments if the entry author name and comment author name are exactly the same with this code:

Code: Select all

{if $entry.author == $comment.author}serendipity_comment_author_self{/if}


So, in your stylesheet, simply add whatever unique styling you want to make author comments stand out from the masses.

You could make this a bit stronger by making sure that the author email addresses match in addition to the names by changing the above if condition to this:

Code: Select all

{if ($entry.author == $comment.author) and ($entry.email == $comment.clear_email)}


It can still be defeated if someone knows the author's email address, but it is one more precaution.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Tue Aug 19, 2008 10:33 am

Hi!

Also, the "User Self-Registration" plugin has an option to "Prevent identity theft". You can only post as an author name, if you are logged in with that name.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 9:39 pm

Re: Way to indicate comments made by (logged in) user/admin

Post by Bernardo » Mon Mar 19, 2012 3:42 pm

Hi!
Sorry to dig up such an old thread.

I want to style my comments.tpl, so that it shows a different style for the blog owners comments, regardless of being logged in or not.

Is there any template variable I can use for that purpose? "$comment.clear_email" doesn't help in that case.

Thanks in advance,
Bernardo

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by onli » Mon Mar 19, 2012 4:31 pm

Bernardo wrote: I want to style my comments.tpl, so that it shows a different style for the blog owners comments, regardless of being logged in or not.
When not being logged in when viewing or when writing the comment?

Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 9:39 pm

Re: Way to indicate comments made by (logged in) user/admin

Post by Bernardo » Mon Mar 19, 2012 4:35 pm

When not being logged in when viewing or when writing the comment?
When viewing the comments, the blog owners comments have to be visually different from all other comments.

I just want to add a specific css class to accomplish that...all I need to know is if there is some kind of template variable I can ideally work with.

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by onli » Mon Mar 19, 2012 4:43 pm

That should already be the case with most templates, that's why i asked.

serendipity_comment_author_self would be that css-class. In the comments.tpl from bulletproof is that code:

Code: Select all

{if $entry.author == $comment.author}serendipity_comment_author_self{/if}
It is not necessarily the blog-owner, but the entry-author, which should fit most of the time (or is this a case in which this is not enough?)

Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 9:39 pm

Re: Way to indicate comments made by (logged in) user/admin

Post by Bernardo » Mon Mar 19, 2012 4:59 pm

Sorry, but that's not what I meant...I'll try to clarify this:

- some unknown user (who is not logged in) views an entry with comments
- there are 5 comments, one of them by the blog owner
- all comments look alike, except for the one by the blog owner (because it has a special css class)

In my opinion, the code you posted seems to add a css class if the person who comments on an article is the same person who wrote the article (which is not what I need). I need EVERY visitor to be able to distinguish between "normal" comments and "owner" comments.

...or did I just miss the point here? :?

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by onli » Mon Mar 19, 2012 5:07 pm

Bernardo wrote:...or did I just miss the point here?
I think so. I'm not totally sure.

So, someone comments. Afterwards, every visitor gets presented the commentlist. When generating the list, the code i pasted checks for every comment wether the author is the same as the entry-author or not. If yes, the template adds the css-class.

I am kind of convinced that this is what you wants (with the only difference of entry-author != blog-owner, sometimes).

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by Don Chambers » Mon Mar 19, 2012 5:29 pm

Here is an example of using the class "serendipity_comment_author_self"... the author (me) comments are visually different from any other comments.

I personally test the comment author name and email against the entry name and email as mentioned above in an earlier post of mine.

If you have many entry authors, but only a single blog owner, you could test the comment name and/or email for something very specific, such as:

Code: Select all

{if ($comment.author == 'Bernardo') and ($comment.clear_email == 'bernardo@example.com')}serendipity_comment_author_self{/if}
Of course, the class name can be anything you want, not just serendipity_comment_author_self... in fact, you may want to use something more precise, like 'blog_owner_comment'.

Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 9:39 pm

Re: Way to indicate comments made by (logged in) user/admin

Post by Bernardo » Mon Mar 19, 2012 6:26 pm

Okay, I see your point...it's not really failsafe, though. My intention was to check the given mail address because the blog owner might want to name himself (for example) "The big bad administer man" (and not the exact name from the blog config).

...and I'm not quite sure if I'm missing the point again...or if my idea is, in fact, complete nonsense... :D

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by Don Chambers » Mon Mar 19, 2012 6:41 pm

Bernardo wrote:Okay, I see your point...it's not really failsafe, though. My intention was to check the given mail address because the blog owner might want to name himself (for example) "The big bad administer man" (and not the exact name from the blog config).

...and I'm not quite sure if I'm missing the point again...or if my idea is, in fact, complete nonsense... :D
Then just check the comment's submitted email address per my example above:

Code: Select all

{if ($comment.clear_email == 'bernardo@example.com')}serendipity_comment_author_self{/if}

Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 9:39 pm

Re: Way to indicate comments made by (logged in) user/admin

Post by Bernardo » Mon Mar 19, 2012 7:47 pm

I already had that idea...but it seemed to me that $comment.clear_email only seems to work when logged in...that's why I was asking in the first place... :-)

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Way to indicate comments made by (logged in) user/admin

Post by Don Chambers » Mon Mar 19, 2012 8:49 pm

Try this:

Code: Select all

{if $commentform_entry.email =='bernard@example.com'}your_class_name_here{/if}

Post Reply