Re: Way to indicate comments made by (logged in) user/admin
Posted: Mon Mar 19, 2012 9:24 pm
Now ALL comment entries have the custom class, because $commentform_entry.email is ALWAYS the same mail address (= the blog owners).
User and developer community
https://board.s9y.org/
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.Bernardo wrote:Now ALL comment entries have the custom class, because $commentform_entry.email is ALWAYS the same mail address (= the blog owners).
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).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.
I know...Don Chambers wrote:commentform.tpl is the actual comment form... comments.tpl displays the comments that have already been posted.
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 wrote:Is it possible that your logical test is occuring in the wrong location, such as the wrong place in a loop?
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?
Code: Select all
<div class="serendipity_comment_source icon_link">Code: Select all
<div class="serendipity_comment_source_admin icon_link">Code: Select all
<div class="serendipity_comment_source{if $commentform_entry.email =='YOUR_EMAIL_ADDRESS HERE'}_admin{/if} icon_link">Actually, no...Don Chambers wrote:Are we having fun yet??!!
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.Don Chambers wrote:This is how I think it SHOULD work, based solely on the email address provided when the comment is submitted:
I don't think so...but here you go:onli wrote:And the commentform.tpl. It's possibly you set this email-adress there.
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> </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> </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>
Well...now I'm curious:Don Chambers wrote:Please post the entire code for comments.tpl
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}
Code: Select all
{if $comment.url == 'http://www.bernhard-runzheimer.de/blog'}_admin{/if}