XF 2.1 Separate permissions for thread starter

Wildcat Media

Well-known member
This is kind of an obscure request for one forum I am working on, but I'll see if I can explain it clearly enough.

We have an edit/delete timeout on the forum of 10 minutes. This will not be changed--I have had too many incidents over the past couple of decades where an upset member will come in and either delete or edit their posts (replacing all text with a ".") for whatever reason. We also have had drive-by harassments--leave it posted enough to get someone worked up, then delete the post. So, changing the edit/delete timeout is out of the question.

I have one forum category which is available only to certain members, and in that entire category, I want the first post in the thread to be editable by the original author, with no editing timeout. I do not want anyone else in the thread to be able to edit or delete their replies, for the reason I stated above.

Is there a way to set XenForo usergroup or node permissions to make this work? I was unable to find anything myself.

Since that is likely not possible, I have an alternate idea. I would create a child theme for that forum category which would override the user's chosen theme. I would then make a template edit in this theme that might work in one of two ways. I would surround the "Edit" and "Delete" links at the bottom each post with a conditional statement. This conditional would do either of these:

1. Edit and Delete controls hidden for all users, except for the thread starter (who could then edit/delete their own replies in the thread)
---or---
2. Edit and Delete controls hidden for all posts except the first post in the thread.

I realize that this means my pseudo "edit/delete time-out" would effectively be zero, but the replies in the threads would be minimal anyways, both in number and in content.

Are there variables available that would allow me do either of the two? I do not know what is revealed from XenForo that I could use inside conditionals to do what I wanted.

The only other option might be to use an add-on, but I have never seen one, and it's not that important where I would want to dump a ton of money into it.
 
I found where to edit, in the post_macros template.

I'm halfway there. :) I have Edit showing only on the first post, using this:

Code:
<xf:if is="$post.canEdit() && $post.isFirstPost()">

Now, I just need to make this display for moderators also. Some pseudo-code here:

Code:
<xf:if is="($post.canEdit() && $post.isFirstPost()) || $visitor_is_a_moderator_variable_here">

Delete function of course would be similar.

Change of plans. Rather than creating a custom theme for this area, I would prefer to include an added conditional with an array of nodes that this would affect. For example--only in nodes 15, 37, 42 , show post editor control only in the first post, but still allow it to show for all moderators.

This new template syntax is not coming easy to me yet. Any ideas for me?
 
Last edited:
I realize that this means my pseudo "edit/delete time-out" would effectively be zero, but the replies in the threads would be minimal anyways, both in number and in content.
I assume you mean "unlimited", as you'd have to change that to allow the editing to take place. Any template changes wouldn't override the server side checks to do this.

In terms of moderators, {$xf.visitor.is_moderator} would be an approximation (it wouldn't account for forum specific permissions, etc). The node ID could be accessed via {$post.Thread.node_id}.
 
I assume you mean "unlimited", as you'd have to change that to allow the editing to take place. Any template changes wouldn't override the server side checks to do this.
Correct--I meant "unlimited." I realize it is something of a hack, but for the time being this will work nicely.
In terms of moderators, {$xf.visitor.is_moderator} would be an approximation (it wouldn't account for forum specific permissions, etc). The node ID could be accessed via {$post.Thread.node_id}.
Perfect! I wasn't sure how the variables were structured in XF 2. No worries on permissions--I have permissions set very simply throughout the forum, and all moderators on staff have the same access throughout the forums.

So just to check, I am safe nesting nexting the conditionals within parentheses, as I did in this example? And did I do it correctly?

Code:
<xf:if is="($post.canEdit() && $post.isFirstPost()) || $visitor_is_a_moderator_variable_here">

Also, I would assume the "not" operator is still "!". Would it be applied directly in front of a variable, such as !{$post.Thread.node_id} or !$post.canEdit()?

Thank you for the assistance!
 
So just to check, I am safe nesting nexting the conditionals within parentheses, as I did in this example? And did I do it correctly?
You can use parents and that looks correct.

Also, I would assume the "not" operator is still "!". Would it be applied directly in front of a variable, such as !{$post.Thread.node_id} or !$post.canEdit()?
Correct in both instances.
 
Back
Top Bottom