![]() |
This very simple hack will show a checkbox in the options area (with show signature, email notification, etc.) of the Reply
to Topic screen that allows you to close the thread at the same time as posting your reply to the thread. The checkbox will only show to those that have permission to close the thread. Tested by me on 2.2.1. Compatibility with earlier versions is likely but not proven. This hack was requested by Freestyler here. EDIT: This hack has been updated; the attachment is now in Post #9. |
Great. Installing right now.
|
Thankyou JJR512!
I'll get our 'vB guy' (Apollo) to install it as soon as he's got time, and we'll let you know how it goes! |
Great little hack, thanks
|
Very useful indeed. I'm adding this hack when I transfer my forums to my new site. Thanks for a simple, yet every effective hack! :)
|
A well overdue hack, good work fella :)
|
Thx!! Works great :)
Greetz, Mystics |
Installed here, nice hack. :)
One thing though, to make sure users can't manipulate forms and close a thread, you should replace: Code:
if ($closethread=="yes") { Code:
if ($closethread=="yes"[high] and $permissions['canopenclose']==1[/high]) { |
Good idea, FireFly! :) I've added that into the instructions.
The new instructions are attached to this post. EDIT: This hack has been updated, and the instructions are now attached to Post #14 below. |
Security is always a good idea. :)
|
Good job, JJR! This will come in handy. :)
|
Wouldn't it be better to add "newpost_closethread" to the $templatesused variable at the top of newreply.php, to save one SQL query on every reply page?
Also, to preserve the checkbox's state when previewing post, I would put this in newreply.php: PHP Code:
Quote:
|
How does putting the template name in the $templateused variable save a query?
|
I have updated the instructions so that the check box maintains its status during a reply preview, although I used a slightly different way (I used the iif function).
EDIT: Another update :rolleyes: attached in the next reply. |
Sorry...
There was a potential problem I was unaware of, until I started testing with the preview function. Due to where in newreply.php I specified to place the code that actually closed the thread, the thread would have been closed immediately upon hitting the Preview button. Now I think that anyone that could use the checkbox and actually close the thread could probably also post a reply to a closed thread, so that wouldn't have been a problem...but if, after hitting Preview, the user just abandoned the reply (clicked the navigation link back into the forum or the home page or whatever, without submitting the reply), the thread would still be closed. Therefore, I have adjusted the instructions so the thread isn't closed until the reply is actually submitted. If you have already installed this hack, you should undo the first step of modifying newreply.php (just find what it tells you to add, and remove it). Then download the new instructions and do what it says in the same step. |
Quote:
Thanks for fixing your hack! I think I accidently closed a thread while I was playing with it, but now I can't find it... :( Oh well, let my users think I'm a bad administrator. ;) |
OK, thanks for explaining that...I didn't really know what the point of that variable was. Now I have some hacks to go fix...:( :D
(I've updated the previously-posted instructions to reflect an appropriate change.) |
Man is this a time saver! Thanks:)
It would be even better if you could add sticky, move, etc... Just a thought. |
@JJR512
Thx for the Hack, but in your last updated instructions is a new (small) bug :rolleyes: @Point 3. you wrote: Quote:
Quote:
Mystics |
OK, thanks...I've updated the instructions.
|
Great hack, JJR. I installed the new, updated version at The Smallville Torch and it works like a charm.
I also installed the previously updated version at my board at Simpsons board. What are the differences? I seem to have no problems with the hack at SB as is. But, if I need to reinstall, please let me know. |
Without knowing which exact version you have, I couldn't really tell you what the difference is...you can find which version you have in the instructions.txt file, there's a version history at the top. That also tells you what the differences are.
Basically, the C and D releases are fine (D is just fixes a poorly-written instruction as pointed out by Mystics). In all the earlier versions, a thread would get closed even if someone who had checked the box just hit the Preview button, and this might not be desirable operation. In the original version, there was also a small security hole that could allow anyone to close any thread if they knew how to manipulate forms data and tried it. Functionally, every version has done the basic idea of what this hack is, but I would use at least version C. |
Quote:
|
JJR,
Any chance you might attatch a fully updated file to your first post. This thread is full of updates and changes. Would be nice to have a completed hack to grab from post one. Just a thought. |
The current release is in Post #15; this is the link to the attachment: https://vborg.vbsupport.ru/attachmen...&postid=210636
What I don't like about having the attachment stay in the first post is that for some other hacks, especially popular ones that spawn multi-page threads, as I read through the thread and see various problems and issues brought up, discussed, solved, etc., I'm left wondering, did the attachment get updated with the fixes? So I thought that instead of doing it that way, I would post a new attachment in any thread where I announce an update, and delete the previous attachment...but each time, make sure to specify where the attachment was. The post numbers are great for this. Also, this method makes it so that someone can't just look at the first post in the thread, read the original description of the hack and just download it without actually going through the thread to read about the various nuances and tricks. Granted, this particular hack is very simple, but another of mine isn't. |
Despite Firefly's security update normal users can still close a thread although they did not started the thread themselves.
Our board has for all registered users configured 'can open/close own threads' set to 'yes'. With this option set, every user is able to use 'Close Thread with Reply' and thus closing the thread. When the option 'can open/close own threads' is set to 'no', the 'Close Thread with Reply' option disappears. Even tough the hack check for permissions, it checks for the wrong permission, more specific for the permission 'can open/close own threads'. I couldn't find an option 'can open/close threads other threads' anywhere. Just to let you know. Alas, I can't use the hack right now :-( |
Good job DJR,
I never even noticed that. |
Please fix this.
|
Thank you for this usefull little hack. Very easy to install and it works :)
|
ups, something isn't right. I, as an admin, see the checkbox an can use it. My Mods doesn't see it, but can open/close threads in their forums on the normal way.
What is wrong? |
seems depending on Groups Permissions. But i have Stanard-Permissions for our Mods.
Must be one of these settings: Can Move own threads to other forums Can open / close own threads Can delete own threads by deleting the first post These settings are turned off for my mods. |
|
Installed, works like a charm.
|
Ok, i fixed it. Here we go:
In the Hack Instructions find: Code:
} else { Code:
} else { Code:
if ($permissions['canopenclose']==1) { Code:
if ($bbuserinfo[usergroupid]==5 || $bbuserinfo[usergroupid]==6 || $bbuserinfo[usergroupid]==7) { Sorry for my bad english... :) |
Oh, yes.. if you allready installed it, you can use this changes in your newreply.php...
|
Super fix! :up: Major thanks!
|
Thnx for the fix AlexD
|
if you still want it the way, it should work, try this:
PHP Code:
See it in Action on http://www.hotornot.de |
I tried the fix by pwr_sneak.
What I found is that as an Admin, if I change the permissions for the admin user group to NOT be able to close own threads, that I did not see the checkbox for ANY thread, regardless of who started it. Correct me if I'm wrong, but the way the hack is in the last version that I posted, will work just fine for the vast majority of people who use the default permissions scheme, where admins can close any thread, mods can close threads in their forums, and regular members cannot close any threads at all, right? If this is true, then I'm leaving my version posted as-is. If you use a different permission scheme, then it kind of complicates things, and I think part of the problem is that there is no permission setting (that I can find) that lets a user or user group be able to close any thread, just the one where they can close their own threads. |
Your last Version uses hard-coded usergroupid and it don't let the user close his own thread if he started it.
If you changed your Admin Usergroup not to close their own threads, why should they have permission to close any thread?? Anyway, I got another Version which should work for not only the majority of forums but all, because its fully based upon the permission system in VBulletin. PHP Code:
It first checks if the user is Moderator for this Forum or even SuperModerator and then (if not) asks for the permission "Close own threads" and if the User has started this thread. |
All times are GMT. The time now is 02:46 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|