• Welcome to Simple Machines Community Forum. Please login or sign up.
December 01, 2021, 03:49:35 AM

News:

SMF 2.0.18 has been released! Please update. Read more.


Admin Lock Thread

Started by bananas21ca, December 26, 2007, 06:14:15 PM

Previous topic - Next topic

bananas21ca

December 26, 2007, 06:14:15 PM Last Edit: December 28, 2007, 05:18:06 PM by bananas21ca
Link to Mod




Admin Lock Thread v1.1

By Bananas21ca








Description

Locks threads from posting by anyone who is not an admin. This Includes Global Moderators.
Great way to prevent moderators from unlocking topics you don't want reopened.



Installation

Simply install the package to install this modification on the Default theme.


You will have to manually edit if you have a custom theme.


To add this mod to a custom theme, open the Display.template.php file for your theme and search for:
$mod_buttons = array(
'move' => array('test' => 'can_move', 'text' => 132, 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'),

'delete' => array('test' => 'can_delete', 'text' => 63, 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt[162] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id']),

'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'smf279' : 'smf280', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'smf277' : 'smf278', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

'merge' => array('test' => 'can_merge', 'text' => 'smf252', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),

'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),

'calendar' => array('test' => 'calendar_post', 'text' => 'calendar37', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id']),

);


And add:
'adminlock' => array('test' => 'can_alock', 'text' => empty($context['is_alocked']) ? 'smf281' : 'smf282', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=alock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

Like so:
$mod_buttons = array(
               'adminlock' => array('test' => 'can_alock', 'text' => empty($context['is_alocked']) ? 'smf281' : 'smf282', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=alock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

                'move' => array('test' => 'can_move', 'text' => 132, 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'),

'delete' => array('test' => 'can_delete', 'text' => 63, 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt[162] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id']),

'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'smf279' : 'smf280', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'smf277' : 'smf278', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),

'merge' => array('test' => 'can_merge', 'text' => 'smf252', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),

'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start']),

'calendar' => array('test' => 'calendar_post', 'text' => 'calendar37', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id']),

);


How Do I Use This Mod?

After the mod is installed a new button will be available on the Moderator Control Panel at the bottom of every thread.
Simply click "Admin Lock" and the thread will be locked to admins only


Changelog

1.0

o Initial release

1.1

o Embedded Admin Lock function inside LockTopic.php

1.2

o Bug: Fixed "Undefined index: is_alocked" Errors in Subs.php

CiOooo

December 27, 2007, 08:40:21 AM #1 Last Edit: December 27, 2007, 08:53:00 AM by CiOooo
tnx for mod. ;)



Apllicmz

Nice work man...
i like that mod



Shadow03

Nice job! I'm impressed. This should help prevent staff members from spamming.

bananas21ca

The next version im working on will prevent Moderators from Editing, Moving, Merging, deleting or any other feeble attempts to get around the Admin Lock.

Also if anyone wants to come up with a better looking GIF for the Admin Lock feel free to. I'll give you full credit if I use it in the mod. Im not much of an artist myself :P

Anyway,
Thanks for the Support guys, I really appreciate it ;)

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

edi67

everything is ok but why a lot of these errors:

8: Undefined index: is_alocked
File: /home2/crazyzonews/www/Sources/Subs.php
Linea: 3340
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

karlbenson

edi67 try
Open subs.php

FIND
if ($topic_context['is_alocked'])
      $topic_context['class'] = 'alocked';

REPLACE
if (!empty($topic_context['is_alocked']))
      $topic_context['class'] = 'alocked';

edi67

Quote from: karlbenson on December 28, 2007, 02:47:50 PM
edi67 try
Open subs.php

FIND
if ($topic_context['is_alocked'])
      $topic_context['class'] = 'alocked';

REPLACE
if (!empty($topic_context['is_alocked']))
      $topic_context['class'] = 'alocked';

thx for your help Karl i will do
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

bananas21ca

Quote from: edi67 on December 28, 2007, 01:39:31 PM
everything is ok but why a lot of these errors:

8: Undefined index: is_alocked
File: /home2/crazyzonews/www/Sources/Subs.php
Linea: 3340


oops! I'll have to fix that.
Thanks for the fix Karl

bananas21ca

I just posted the updated package.
I hope thats all the bugs..... :-\

karlbenson

Bananas.

In another topic there was an issue that this mod wouldn't go through a Package Parser because you've structured the mod inside a folder

Package (inside it)
->Folder
- -- > File
- -- > File

Without being inside a folder, it will go through a package parser like
http://sleepycode.com/PackageParser/index.php
making it alot easier for some people to manually install it on other themes and manually as is necessary.

ne.miguelito

cannot put an image as this:




where that is marked would have an image to say locked

bananas21ca

Quote from: karlbenson on December 28, 2007, 05:34:01 PM
Bananas.

In another topic there was an issue that this mod wouldn't go through a Package Parser because you've structured the mod inside a folder

Package (inside it)
->Folder
- -- > File
- -- > File

Without being inside a folder, it will go through a package parser like
hxxp:sleepycode.com/PackageParser/index.php [nonactive]
making it alot easier for some people to manually install it on other themes and manually as is necessary.

The v1.2 package seems to work with the Package Parser. Might have something to do with the fact it was a tar.gz the first time. If it's easier for everyone i'll package it as a .zip on my next release.

Quote from: ne.miguelito on December 28, 2007, 05:50:36 PM
cannot put an image as this:

hxxp:maxupload.com/img/E405AA18.jpg [nonactive]


where that is marked would have an image to say locked

That will be included in my next release. Forgot all about it.
In the meantime just regular lock it too, to show the lock symbol.

ne.miguelito

Quote
That will be included in my next release. Forgot all about it.
In the meantime just regular lock it too, to show the lock symbol.

but if it is alone locked with the Admin Lock Thread doesn't appear anything...

bananas21ca

Quote from: ne.miguelito on December 28, 2007, 08:42:38 PM
Quote
That will be included in my next release. Forgot all about it.
In the meantime just regular lock it too, to show the lock symbol.

but if it is alone locked with the Admin Lock Thread doesn't appear anything...

It won't appear on the board index, but there is a custom "Admin Locked" graphic on the actual thread.
Like I said earlier i'll be putting some sort of lock symbol on the board index in the next version of the mod.

ManilaGurL

I dont see Display.template.php. I am using Dilber MC Theme. How do I add this one?

Thanks.

Garry1953

Could prove a handy mod for my forum.
Thanks

Chriss Cohn

Cool i'm looking forward to any new release of this mod (with included locking-picture)....

Keep up the good work...

bananas21ca

Quote from: ManilaGurL on January 17, 2008, 08:38:38 AM
I dont see Display.template.php. I am using Dilber MC Theme. How do I add this one?

Thanks.

if your theme don't have the Display.template.php file, its using the default themes file which means it should be installed. This may not be true for all themes though, all the ones i've worked with followed the same format.
If you could show me a link to the theme i'll take a look when I have a sec to spare.

Advertisement: