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

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

Now ALL comment entries have the custom class, because $commentform_entry.email is ALWAYS the same mail address (= the blog owners).
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

I think we need to see a URL to your site....

Why would all comments be using the blog owner's email address?
=Don=
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

http://www.bernhard-runzheimer.de/blog/ ... l#comments

At the moment, I'm checking the commenters url to set the custom css class...so this is actually how it should look like (blue user icons = "normal" comments, black user icon = blog owner comment).
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Bernardo wrote:Now ALL comment entries have the custom class, because $commentform_entry.email is ALWAYS the same mail address (= the blog owners).
Let me ask again - Why does every comment author have the same email address, and why are those identical email addresses the same as the blog owner (you)? Each person submitting a comment should be using their own email address, and therefore not triggering the custom author class. Having said that, I see nothing wrong with testing the URL field for a match either.
=Don=
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

Don Chambers wrote:Let me ask again - Why does every comment author have the same email address, and why are those identical email addresses the same as the blog owner (you)? Each person submitting a comment should be using their own email address, and therefore not triggering the custom author class. Having said that, I see nothing wrong with testing the URL field for a match either.
Well, maybe because I used it in the wrong place. I have to use a template variable in comments.tpl, not in commentform.tpl. If I use $commentform_entry.email in comments.tpl (which seems to be wrong imo), it shows the same address for all user comments (which would result in three black user icons for the given example url).

I have the constant feeling that there is some kind of miscommunication happening here...or maybe I'm just to blind to see...
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

commentform.tpl is the actual comment form... comments.tpl displays the comments that have already been posted.

Is it possible that your logical test is occuring in the wrong location, such as the wrong place in a loop? Can you post the entire comments.tpl?
=Don=
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

Don Chambers wrote:commentform.tpl is the actual comment form... comments.tpl displays the comments that have already been posted.
I know...
Don Chambers wrote:Is it possible that your logical test is occuring in the wrong location, such as the wrong place in a loop?
Maybe that's the point where we're talking about different things. I render the custom class in comments.tpl, when the comments are generated for viewing. Why would I put the test in the commentform.tpl?
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Bernardo wrote:Maybe that's the point where we're talking about different things. I render the custom class in comments.tpl, when the comments are generated for viewing. Why would I put the test in the commentform.tpl?

You don't put it in commentform.tpl... put it in comments.tpl.
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Are we having fun yet??!! :mrgreen:

OK, some where in your comments.tpl, you are setting one of two classes:

Either this:

Code: Select all

<div class="serendipity_comment_source icon_link">
or this:

Code: Select all

<div class="serendipity_comment_source_admin icon_link">
This is how I think it SHOULD work, based solely on the email address provided when the comment is submitted:

Code: Select all

<div class="serendipity_comment_source{if $commentform_entry.email =='YOUR_EMAIL_ADDRESS HERE'}_admin{/if} icon_link">
I have not yet seen your actual comments.tpl, but this SHOULD work provided it is placed in the proper location within the foreach loop.
=Don=
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

Don Chambers wrote:Are we having fun yet??!! :mrgreen:
Actually, no... :mrgreen: ...I'm getting confused more and more...
Don Chambers wrote:This is how I think it SHOULD work, based solely on the email address provided when the comment is submitted:
That's exactly what I did after you mentioned it for the first time. The result is what I have described earlier: All user comments have a black user (because they seem to have the same mail address). See attached pic. The displayed mail address is the output of $commentform_entry.email.
Attachments
screenshot.gif
screenshot.gif (10.32 KiB) Viewed 7744 times
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Please post the entire code for comments.tpl
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

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

Post by onli »

And the commentform.tpl. It's possibly you set this email-adress there.
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

onli wrote:And the commentform.tpl. It's possibly you set this email-adress there.
I don't think so...but here you go:

Code: Select all

<div id="serendipityCommentFormC" class="serendipityCommentForm">
    <div id="serendipity_replyform_0"></div>
    <a id="serendipity_CommentForm"></a>
    <form id="serendipity_comment" action="{$commentform_action}#feedback" method="post">
    <div><input type="hidden" name="serendipity[entry_id]" value="{$commentform_id}" /></div>
    <table border="0" width="100%" cellpadding="3" summary="commentform">
        <tr>
            <td class="serendipity_commentsLabel"><label for="serendipity_commentform_name">{$CONST.NAME}</label></td>
            <td class="serendipity_commentsValue"><input type="text" id="serendipity_commentform_name" name="serendipity[name]" value="{$commentform_name}" size="30" /></td>
        </tr>

        <tr>
            <td class="serendipity_commentsLabel"><label for="serendipity_commentform_email">{$CONST.EMAIL}</label></td>
            <td class="serendipity_commentsValue"><input type="text" id="serendipity_commentform_email" name="serendipity[email]" value="{$commentform_email}" /></td>
        </tr>

        <tr>
            <td class="serendipity_commentsLabel"><label for="serendipity_commentform_url">{$CONST.HOMEPAGE}</label></td>
            <td class="serendipity_commentsValue"><input type="text" id="serendipity_commentform_url" name="serendipity[url]" value="{$commentform_url}" /></td>
        </tr>

        <tr>
            <td class="serendipity_commentsLabel"><label for="serendipity_replyTo">{$CONST.IN_REPLY_TO}</label></td>
            <td class="serendipity_commentsValue">{$commentform_replyTo}</td>
        </tr>

        <tr>
            <td class="serendipity_commentsLabel"><label for="serendipity_commentform_comment">{$CONST.COMMENT}</label></td>
            <td class="serendipity_commentsValue">
                <textarea rows="10" cols="40" id="serendipity_commentform_comment" name="serendipity[comment]">{$commentform_data}</textarea><br />
                {serendipity_hookPlugin hook="frontend_comment" data=$commentform_entry}
            </td>
        </tr>

{if $is_commentform_showToolbar}
        <tr>
            <td>&#160;</td>
            <td class="serendipity_commentsLabel">
                <input id="checkbox_remember" type="checkbox" name="serendipity[remember]" {$commentform_remember} /><label for="checkbox_remember">{$CONST.REMEMBER_INFO}</label>
    {if $is_allowSubscriptions}
                <br />
                <input id="checkbox_subscribe" type="checkbox" name="serendipity[subscribe]" {$commentform_subscribe} /><label for="checkbox_subscribe">{$CONST.SUBSCRIBE_TO_THIS_ENTRY}</label>
    {/if}
            </td>
       </tr>
{/if}

{if $is_moderate_comments}
       <tr>
            <td class="serendipity_commentsValue serendipity_msg_important" colspan="2">{$CONST.COMMENTS_WILL_BE_MODERATED}</td>
       </tr>
{/if}

       <tr>
            <td>&#160;</td>
            <td><input type="submit" name="serendipity[submit]" value="{$CONST.SUBMIT_COMMENT}" /> <input type="submit" id="serendipity_preview" name="serendipity[preview]" value="{$CONST.PREVIEW}" /></td>
        </tr>
    </table>
    </form>
</div>
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

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

Post by Bernardo »

Don Chambers wrote:Please post the entire code for comments.tpl
Well...now I'm curious:

Code: Select all

{foreach from=$comments item=comment name="comments"}
    <a id="c{$comment.id}"></a>
    <div id="serendipity_comment_{$comment.id}" class="serendipity_comment serendipity_comment_author_{$comment.author|@makeFilename} {if $entry.author == $comment.author}serendipity_comment_author_self{/if} {cycle values="comment_oddbox, comment_evenbox"}" style="padding-left: {$comment.depth*20}px">
        <div class="serendipity_commentBody">
        {if $comment.body == 'COMMENT_DELETED'}
            {$CONST.COMMENT_IS_DELETED}
        {else}
            {$comment.body}
        {/if}
			<div class="comment_arrow"><!-- arrow --></div>
        </div>
        <div class="serendipity_comment_source{if $comment.url == 'http://www.bernhard-runzheimer.de/blog'}_admin{/if} icon_link">
			<div class="fleft">
	            <span class="comment_source_author">
	            {if $comment.email}
	                <a href="mailto:{$comment.email}">{$comment.author|@default:$CONST.ANONYMOUS}</a>
	            {else}
	                {$comment.author|@default:$CONST.ANONYMOUS}
	            {/if}
	            </span>
	            {$CONST.ON}
	            <span class="comment_source_date">{$comment.timestamp|@formatTime:$CONST.DATE_FORMAT_SHORT}</span>
			</div>
			<div class="fright" style="width:100px">
	            {if $entry.allow_comments AND $comment.body != 'COMMENT_DELETED'}
	                <a title="{$CONST.REPLY}" class="comment_reply icon_link icon_comment_reply fright" href="#feedback" id="serendipity_reply_{$comment.id}" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}'; {$comment_onchange}"><!-- reply --></a>
	                <div id="serendipity_replyform_{$comment.id}"></div>
	            {/if}
	            {if $entry.is_entry_owner}
	                <a title="{$CONST.DELETE}" class="comment_source_ownerlink icon_link icon_comment_delete fright" href="{$comment.link_delete}" onclick="return confirm('{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.author}');"><!-- delete --></a>
	            {/if}
	            {if $comment.url}
	                <a class="comment_source_url icon_link icon_website fright" href="{$comment.url}" title="{$comment.url|@escape}"><!-- website --></a>
	            {/if}
				<div class="clear"><!-- clear --></div>
			</div>
			<div class="clear"><!-- clear --></div>
        </div>
    </div>
{foreachelse}
    <div class="serendipity_left nocomments">{$CONST.NO_COMMENTS}</div>
{/foreach}
I replaced that part

Code: Select all

{if $comment.url == 'http://www.bernhard-runzheimer.de/blog'}_admin{/if}
with the one you mentioned earlier...which results in the behaviour of the previously attached pic.

Still curious what I may have done wrong...
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Before I review these tpls, can you verify that these three comments are saved with different email addresses, and that all three do not actually have the same email address?
=Don=
Post Reply