Friday 17 December 2010 2:48:31 am
I explain again the context: By default, the extension ezcomments displays the links "Edit" and "Delete" at the bottom of all comments regardless of the specific rights of the user. My original question (see my first post) was: how to display the links "Edit" and "Delete" only if the user has the right to edit and/or delete the comment ? Daisy founded the solution: We have to replace (in comment_item.tpl):
<div class="ezcom-comment-tool">
{if or( $can_edit, $can_self_edit )}
{if and( $can_self_edit, not( $can_edit ) )}
{def $displayAttribute=$user_display_limit_class}
{else}
{def $displayAttribute=''}
{/if}
<span{$displayAttribute}>
<a href={concat( '/comment/edit/', $comment.id )|ezurl}>{'Edit'|i18n('ezcomments/comment/view')}</a>
</span>
{undef $displayAttribute}
{/if}
{if or( $can_delete, $can_self_delete )}
{if and( $can_self_delete, not( $can_delete ) )}
{def $displayAttribute=$user_display_limit_class}
{else}
{def $displayAttribute=''}
{/if}
<span {$displayAttribute}>
<a href={concat( '/comment/delete/',$comment.id )|ezurl}>
{'Delete'|i18n('ezcomments/comment/view')}
</a>
</span>
{undef $displayAttribute}
{/if}
</div> by:
{if eq( $current_user.contentobject_id, $comment.user_id )}
<span {$displayAttribute}>
<a href={concat( '/comment/edit/', $comment.id )|ezurl}>{'Edit'|i18n('ezcomments/comment/view')}</a>
<a href={concat( '/comment/delete/',$comment.id )|ezurl}>{'Delete'|i18n('ezcomments/comment/view')}</a>
</span>
{undef $displayAttribute}
{/if} Like that, the «Edit» and «Delete» buttons are only shown if the logged in user is the owner of the comment too. More over, this solution avoids to solve the problem I described in my 2de post of this thread.
Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish
|