PDA

View Full Version : Miscellaneous Hacks - Limit Thread Prefix by Usergroup


Opserty
06-23-2008, 10:00 PM
/*================================================= =====================*\
|| ################################################## ################## ||
|| # ---------------- LIMIT THREAD PREFIX BY USERGROUP -------------- # ||
|| # ---------------------- CREATED BY OPSERTY ---------------------- # ||
|| # This modification may not be redistributed without prior consent # ||
|| ################################################## ################## ||
\*================================================ ======================*/


WARNING: THIS MODIFICATION REQUIRES FILE EDITS.
Please follow all instructions carefully before attempting to use this modification


What does this modification do?
This modification allow you to control which Usergroups have access to use certain prefix sets. For example in a Help/Bug Report forum, you may only want to allow staff to prefix problems into categories.

Why does this modification require file edits?
The AdminCP has a minimal number of hook locations onto which to attach plugins, this is done for security and stability reasons by the vBulletin team. Therefore it has not been possible to make this modification 'file edit' free.

What versions of vBulletin does this modification work with?
This modification has been tested to work with 3.7.1, however it will most probably also work on 3.7.0. Please note I cannot offer support for help with this modification on 3.7.0 so if you experience problems it will be best to upgrade to 3.7.1 and then see if your errors are resolved.

How to install:
(These instructions are detailed also in the README file attached in the ZIP Archive.)


1. IMPORT PRODUCT
------------------------------------------------

Import the product as normal through the AdminCP.

AdminCP > Plugins & Products > Manage Products


2. UPLOAD FILE
------------------------------------------------

Upload functions_opserty_prefix_ugps.php to the '/includes/' directory of your forum root


3. MAKE FILE EDIT (1)
------------------------------------------------

Download and Open admincp/prefix.php from your vBulletin installation. (Code additions have been highlighted in Green)

You will need to edit the file in a plain text editor, notepad or wordpad will do fine.

Find (approx. Line 303):



$prefixsetdm->set('displayorder', $vbulletin->GPC['displayorder']);
$prefixsetdm->set_info('title', $vbulletin->GPC['title']);

$prefixsetdm->save();

Replace with:


$prefixsetdm->set('displayorder', $vbulletin->GPC['displayorder']);
$prefixsetdm->set_info('title', $vbulletin->GPC['title']);

require_once(DIR . '/includes/functions_opserty_prefix_ugps.php');
process_selected_groups();

$prefixsetdm->save();

3. MAKE FILE EDIT (2)
------------------------------------------------

Find (approx. Line 448):



if (empty($enabled_forums))
{
// default to selecting "none"
$enabled_forums = array(-1);
}

print_forum_chooser($vbphrase['use_prefix_set_in_these_forums'], 'forumids[]', $enabled_forums, $vbphrase['none'], false, true);

print_submit_row();

Replace with:



if (empty($enabled_forums))
{
// default to selecting "none"
$enabled_forums = array(-1);
}

print_forum_chooser($vbphrase['use_prefix_set_in_these_forums'], 'forumids[]', $enabled_forums, $vbphrase['none'], false, true);

require_once(DIR . '/includes/functions_opserty_prefix_ugps.php');
show_usergroup_list($prefixset['allowedugps']);

print_submit_row();

]


4. UPLOAD
------------------------------------------------

Upload the newly edited prefix.php to your server and test away =]

If you receive PHP Parse errors it means you have probably edited prefix.php incorrectly, download a new copy of prefix.php from vBulletin.com and try editing the file again.

Remember to undo file edits and remove files, if you uninstall this product in order to avoid errors in future.

I have done my best to test this modification, however if you notice any bugs please post them in this thread so I can look into them.

Please do not private message me for support with this modification, all support will be given through this thread ONLY.

KURTZ
06-24-2008, 05:54 PM
nice one mate! :)

ps. it's time to put an avatar ... :p

Opserty
06-24-2008, 06:06 PM
Glad you like it ;)

Well hopefully if I hang around here long enough I might be able to bribe an Admin into getting me promoted and be then be able to get my sticky mits on a vB.org Staff Avatar :D

Gamezod
06-25-2008, 08:16 PM
done well. Thanks for all your help. Ive done some further testing and all seems to work fine.

FleaBag
06-25-2008, 09:27 PM
Great work, thank you. I needed this to allow me to post "Site News" on my vBadvanced without allowing regular users to do so too.

RedGTiVR6
06-27-2008, 02:51 PM
How is this mod different from this one?

https://vborg.vbsupport.ru/showthread.php?t=181644

Charlie98902
06-27-2008, 02:54 PM
How is this mod different from this one?

https://vborg.vbsupport.ru/showthread.php?t=181644

That one is limited to just mods and admins. I think this one still allows users to use prefixes but only the ones you let them?

RedGTiVR6
06-27-2008, 03:33 PM
nope - you can set the user groups per forum via a setting....

Opserty
06-28-2008, 09:09 AM
RedGTiVR6 - That modification is done on a per forum basis I believe (i.e. enable usergroups to use any prefixes in a forum or not).

Where as this modification is per prefix set. With this one you can still allow people to use selected prefixes but restrict certain prefixes to certain User groups, for example only Administrators could use an "Announcement" prefix or something.

transparent
07-01-2008, 03:05 AM
I installed this and it works perfect! I was gonna put in a feature request and then I found this and it's exactly what I needed.

Thank you so much Opserty! :)

Opserty
07-03-2008, 11:03 AM
No problem. I'm glad my first modification has been bug free :D

Slaxi
07-13-2008, 07:10 PM
thanks. Very nice mod!

zhabbo
07-15-2008, 01:39 PM
Excuse me, but how do you actually edit the permissions?

Opserty
07-15-2008, 02:13 PM
You can set the permissions when adding/editing the Prefix Set.

zhabbo
07-15-2008, 02:18 PM
Eh? I took a look at that, and there was nothing there.

zhabbo
07-15-2008, 02:38 PM
OK, found it. Thanks for support and release.

superjeff
08-04-2008, 05:19 AM
Thank you for this!

Opserty
08-04-2008, 09:23 AM
You are most welcome :)

RLShare
08-07-2008, 10:41 PM
Thanks alot for this Opserty, using this I was able to create a front page/semi-CMS where the staff can control whats shown and where its shown on the front page by using certain prefixes on threads. It saved me alot of work.

Opserty
08-08-2008, 08:38 PM
No problem.

Note as of 4th Aug. vBulletin has announced a similar feature in 3.8 development update:

Thread Prefix Permissions
For those who want to be able to limit the ability of their users to access thread prefixes and prefix sets, vBulletin 3.8 now gives you that ability.

As such, further development of this modification seems unlikely. I will however try to ensure that any bugs are fixed.

oz_girl
08-16-2008, 07:21 AM
great mod, reserved :D

nando99
11-05-2008, 02:58 AM
So you can only set usergroup permission when adding new thread prefixes? When I go to edit a prefix, I don't see a way to edit usergroup permissions...

Nevermind.... The permissions are on the prefix set not on individual prefixes... thanks!

puertoblack2003
12-06-2008, 07:10 PM
works well on 3.7.4 :up:

FreneZy
06-08-2009, 12:22 PM
The mod did not works anymore since I upgraded vB to 3.8.1 :(
I have included the file change to the new adminCP prefix.php file.

Seems that the userCP is unable to change anything on the prefix "group" rights.
When I add a new group to enable it to use a prefix, it still is unable to do.
When I remove a group, it still is enable to use prefixes !

So there is something strange and I don't find what ! HELP !!! :)

FreneZy
06-12-2009, 05:21 PM
bump :(

yotsume
07-22-2009, 03:11 AM
I need this for a 3.7x site so I am going to give it a try. It looks very promising!

dimmicosacerchi
10-04-2009, 11:17 AM
Is compatible with 3.8.4?