XF 2.2 Make "People may reply to this thread" unselected by default

SeaWolf

Active member
How can i lock threads by default for some user or user group?
By default the checkbox that say "People may reply to this thread" is checked.
I'd like to have it unchecked, even for everyone and user who have access will have to uncheck it if they want to let people to reply.

Thank you!
 
I don't think it exists. I also think it unlikely it ever will unless you develop it yourself because it isn't something that would be useful for most people.

Sad but true.
 
What i did is removing the strikethrough code in template "helper_thread_options"
...
<xf:if is="$thread.canLockUnlock()">
<xf: option name="discussion_open" value="1" selected="{$thread.discussion_open}"
label="{{ phrase('unlocked') }}"
hint="{{ phrase('people_may_reply_to_this_thread') }}">

<xf:afterhtml>
<xf:hiddenval name="_xfSet[discussion_open]" value="1" />
</xf:afterhtml>
</xf: option>
</xf:if>
...
So the checkbox is not checked by default, but in a thread I have to click on "more options" to display the options and the checkbox is unchecked by default, if I don't click on "more options" the box remains checked.

BUT, this works for me because the user who must remember to uncheck this box to post in a particular "Article" thread and in this article we see by default the "more options" button and then the checkbox is not selected.

ok...well... did you follow me?? 🤪😁
Thanks for replies given and have a great day! 😊
 
Do you want this to happen only when creating a thread? Also, should it only be active in certain forums?

Removing the selected attribute is not a good thing, by the way.
Only to me in one node where i put some articles (they are read only) and another node for a user who write read only articles.
Well, the goal is only for that user to not have to unselect the checkbox...

But...might be better to "educate" that user to remember to uncheck that box ;)
 
Only to me in one node where i put some articles (they are read only) and another node for a user who write read only articles.
Well, the goal is only for that user to not have to unselect the checkbox...

But...might be better to "educate" that user to remember to uncheck that box ;)
Okay, here's a little add-on.

From the add-on's options page you can select the user groups or users that will be affected, as well as the nodes where this will be active.

As far as I remember, the default value for discussion_open is true, so every time you create a thread this option is checked.

I simply use JavaScript to deselect the "Unlocked" option. There are other ways to do this, I just wanted to go with JS. The value of the variable could also be changed or it could be conditional on whether the attribute is added or not.

Deleting the selected attribute will, yes, make it false when creating a thread, but the template you edited is used not only when creating a thread, but also when editing threads, so it will always appear locked, even if the thread is unlocked.

Anyway, please perform your own tests for the add-on, just in case there are any bugs or errors.
 

Attachments

Okay, here's a little add-on.

From the add-on's options page you can select the user groups or users that will be affected, as well as the nodes where this will be active.

As far as I remember, the default value for discussion_open is true, so every time you create a thread this option is checked.

I simply use JavaScript to deselect the "Unlocked" option. There are other ways to do this, I just wanted to go with JS. The value of the variable could also be changed or it could be conditional on whether the attribute is added or not.

Deleting the selected attribute will, yes, make it false when creating a thread, but the template you edited is used not only when creating a thread, but also when editing threads, so it will always appear locked, even if the thread is unlocked.

Anyway, please perform your own tests for the add-on, just in case there are any bugs or errors.
Thank you so much !
I'm out for the weekend, but be sure i will test it when i'll be back :)

Thanks again it is very apreciated :) :)
 
Okay, here's a little add-on.

From the add-on's options page you can select the user groups or users that will be affected, as well as the nodes where this will be active.

As far as I remember, the default value for discussion_open is true, so every time you create a thread this option is checked.

I simply use JavaScript to deselect the "Unlocked" option. There are other ways to do this, I just wanted to go with JS. The value of the variable could also be changed or it could be conditional on whether the attribute is added or not.

Deleting the selected attribute will, yes, make it false when creating a thread, but the template you edited is used not only when creating a thread, but also when editing threads, so it will always appear locked, even if the thread is unlocked.

Anyway, please perform your own tests for the add-on, just in case there are any bugs or errors.
Thank...you...so...much... :D
This is perfect :) So my articles are by default lock when the bloger write her articles.
Thank you so much for that help, everything work fine :):coffee:
(well, the coffee is only because i like and make good coffee, so here's a coffee for you ;))
 
Back
Top Bottom