MyBB Community Forums

Full Version: OP Can Close Thread 1.4.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Version 1.3.1 released:
  • Fixes a faulty comparison when checking for an open thread (the comparison was fine for PHP versions earlier than 8).
  • The "[Open/Close] Thread" button is now shown even to admins/mods who can already close threads, provided that they are picked out by the plugin's settings as for any other usergroup. This reverts the change made in v1.1.1 (commit 4853a5) and closes GitHub issue #4. Thanks to @Eldenroot, @lkop, and @HLFadmin for your advice that this was a desirable change to make.
thank you. but i just wondering if admin can use this close button for other users as well. like normal user A created a thread. now admin can close his thread as well.

sorry if I am asking too much, even if it's a lot of work to add and not suitable to implement, I can understand. thanks a lot for the plugin.
Oh, I see - so, you prefer the plugin to work so that any time an admin/mod has the unconditional right to close (or open) a thread, the button is shown, regardless of plugin (forum/usergroup) settings - rather than respecting plugin settings with conditional right (on being the thread's author) as is now the case with the version I've just released.

I'm open to that idea, but will have to ponder it, because then the button would be doing two (very slightly) different things, and I'm not sure how appropriate that is. Advice and opinions welcome.
1.3.1 version works as described. Remember the name of the plugin "OP can close Thread". If admin or mod is not OP, then they have the ability to use the more robust set of mod tools if presented in footer.

My 2 cents.
Under PHP 8, warning is issued for undefined variable 'opcanclosethread' at line 105 when using AdminCP / Plugins.

Change
	if ($active_plugins && $active_plugins['opcanclosethread']) {
to
	if ($active_plugins && isset($active_plugins['opcanclosethread'])) {

Code is tight. That's the only one I have found.
(2023-01-19, 12:49 PM)HLFadmin Wrote: [ -> ]1.3.1 version works as described. Remember the name of the plugin "OP can close Thread". If admin or mod is not OP, then they have the ability to use the more robust set of mod tools if presented in footer.

My 2 cents.

Somehow I missed this reply. Thanks for weighing in. I think you're right, and you've confirmed my sense, expressed above, that this button should not serve dual purposes. Admins and mods already have the core tools that they need to close and reopen threads.

@lkop, I hope you're not too disappointed, but I won't be implementing your feature request, at least not as an unconditional feature: if you're really keen on it, I suppose that I could add a setting to conditionally enable it, toggled off by default. I'd prefer not to, but could possibly be convinced.

(2023-02-05, 03:50 PM)HLFadmin Wrote: [ -> ]Under PHP 8, warning is issued for undefined variable 'opcanclosethread' at line 105 when using AdminCP / Plugins.

Change
	if ($active_plugins && $active_plugins['opcanclosethread']) {
to
	if ($active_plugins && isset($active_plugins['opcanclosethread'])) {

Code is tight. That's the only one I have found.

Nice catch. Thanks again.

Just a little note: in this scenario, I prefer !empty() to isset(). The former correctly handles the case in which the array entry is set but boolean false, whereas the latter mishandles it. In the current core code, I don't think that such an array entry ever would be set to boolean false, but writing defensive code to handle the possibility anyway is A Good Thing, in my opinion.
Version 1.4.1 released:
  • Fixes various PHP 8 warnings.
  • Fixes various errors in conditional logic.
  • Adds a "Block reopening?" setting.
  • Adds a "Remove prefix on reopening?" setting.
  • Adds handling for post merges.
  • Improves the code in various other minor ways.
Pages: 1 2 3