XF 1.4 Remove the "view" capability of soft-deleted threads

jauburn

Well-known member
On my board, users have the ability to delete their own threads. However, we have recently found it important also to allow members to see the soft deletions (the greyed-out thread text, etc.) so that they know who deleted the thread--i.e., that it was not a heavy-handed admin.

However, understandably the person who deleted the thread does not want the content to remain visible, even to members. So I would like to know how to remove the View capability for registered users (although not for moderators or admins) so that deleted thread content cannot be viewed by members.

The graphic below has an arrow pointing to the text that I would like to remove for all but moderators and admins. Would someone be so kind as to tell me which template I would edit and what conditional code I would use to make this happen?

Thanks!

removeview.webp
 
The thread_list_item_deleted template:

Find:
Code:
<a href="{xen:link threads, $thread}" class="viewLink">{xen:phrase view}</a>

Replace:
Code:
<xen:if is="{$visitor.is_admin} OR {$visitor.is_moderator}">
    <a href="{xen:link threads, $thread}" class="viewLink">{xen:phrase view}</a>
</xen:if>
 
The thread_list_item_deleted template:

Find:
Code:
<a href="{xen:link threads, $thread}" class="viewLink">{xen:phrase view}</a>

Replace:
Code:
<xen:if is="{$visitor.is_admin} OR {$visitor.is_moderator}">
    <a href="{xen:link threads, $thread}" class="viewLink">{xen:phrase view}</a>
</xen:if>

This worked superbly, Brogan. Thank you so much!
 
Brogan, following up on this, I'm told by a user that although deleted threads can no longer be viewed by members and guests using the method above, deleted posts can still be viewed. Would you be so kind as to provide the code necessary for me to implement a similar change so that when a member deleted his/her own post, it can no longer be viewed by other members but by admins and moderators?

Thanks again!
 
Users have permission to see deleted posts (ie. messages) contained within threads, for the same reason?

If you're familiar with template edits, you could start off by finding the appropriate template/loop which handles post render, and wrap the content with the xen syntax that Brogan provided above.
 
Back
Top Bottom