PDA

View Full Version : Display Forum Name and Usergroup in Forum Permission Table Head


Stretchr
01-17-2002, 10:00 PM
This is a simple hack designed to address what may be merely an oversight in the Forumpermission Table. When you're editing a forum, the name of that forum appears in the table head, but when you're editing the permissions, it doesn't. When you're modifying a long string of forum permissions, it's easy to forget which one you're currently doing. This hack addresses that issue and only requires 3 lines of code to the admin/forumpermission.php file. I couldn't have completed this hack without the help of MrLister, who showed me the variable I'd been fruitlessly searching for.

Here's my first hack:

In admin/forumpermission.php, find:

if (isset($forumpermissionid)) {
$forumpermission=$DB_site->query_first("SELECT * FROM forumpermission WHERE forumpermissionid=$forumpermissionid");
makehiddencode("forumpermissionid","$forumpermissionid");

Replace with:
if (isset($forumpermissionid)) {
$forumpermission=$DB_site->query_first("SELECT * FROM forumpermission WHERE forumpermissionid=$forumpermissionid");
makehiddencode("forumpermissionid","$forumpermissionid");
$foruminfo=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$forumpermission[forumid]'");

Note the line that is not indented must stay that way!

Next Find:
} else {
$forumpermission = getpermissions($forumid, 1, intval($usergroupid));
makehiddencode("forumid",$forumid);

Replace with:
} else {
$forumpermission = getpermissions($forumid, 1, intval($usergroupid));
makehiddencode("forumid",$forumid);
$foruminfo=$DB_site->query_first("SELECT title FROM forum WHERE forumid='$forumid'");


Still in admin/forumpermission.php,
Find:
echo "<tr class='tblhead'><td colspan=2><b><input type=\"radio\" name=\"useusergroup\" value=\"1\" ".iif (!isset($forumpermissionid),"checked","")."><span class='tblhead'>Use usergroup default</b> (Note: this will delete any previous custom settings)</span></td></tr>\n";

and Replace with:
echo "<tr class='tblhead'><td colspan=2><b><input type=\"radio\" name=\"useusergroup\" value=\"1\" ".iif (!isset($forumpermissionid),"checked","")."><span class='tblhead'>Use usergroup default</b> (Note: this will delete any previous custom settings)<br>Forum: <b>$foruminfo[title]</b></span></td></tr>\n";

Finally, still in admin/forumpermission.php
Find:
echo "<tr class='tblhead'><td colspan=2><b><input type=\"radio\" name=\"useusergroup\" value=\"0\" ".iif(isset($forumpermissionid),"checked","")."><span class='tblhead'>Use custom settings:</span></b></td></tr>\n";

Replace with:
echo "<tr class='tblhead'><td colspan=2><b><input type=\"radio\" name=\"useusergroup\" value=\"0\" ".iif(isset($forumpermissionid),"checked","")."><span class='tblhead'>Use custom settings:</b><br>Group: <b><i>$forumpermission[title]<i></b></span></td></tr>\n";

Save and upload the file to your admin directory and that's it! Enjoy the hack.

If you have any problems with this hack, please do not email or PM me. Post them to this board so that others can benefit from our experiences.

Stretchr
01-18-2002, 06:45 PM
It's in the txt file but not in the post so FYI:
This hack written and tested on vB 2.2.1

Here's a screen shot:

Shenlong
01-18-2002, 06:49 PM
can we get a demo plz?

Stretchr
01-18-2002, 08:42 PM
Look one post back. There's a screen shot. ;)

MrLister
01-18-2002, 11:17 PM
thanks. I'm just about to do permissions for my forums so it comes in handy. :)

Stretchr
01-19-2002, 05:51 AM
Code changed and text file updated to fix small problem that Forum Name did not display for Custom permissions.

Stretchr
01-19-2002, 04:02 PM
I'm surprised this hasn't gotten a bigger response. It's a little hack but it seemed to be a necessity when you're doing a bunch of Permissions. I'm wondering if it's not really popular because not so many boards use individual permissions for their forums? Any feedback?

mem
01-19-2002, 04:41 PM
nice hack
i like it......

Shenlong
01-19-2002, 05:57 PM
Installed it and my hackers (not real hackers, just ppl who do stuff on my forum) are jumping for joy! thanks so much and i really enjoy the hack..well...they do ;)

Stretchr
01-19-2002, 06:07 PM
You're very welcome. It's nice to be able to give something back after all the great hacks I've used from here. :)

Stretchr
01-25-2002, 05:28 PM
Glad it's working well for you. If anyone runs into a bug or a problem, please feel free to post it here so I can get you fixed up!

Originally posted by Shenlong
Installed it and my hackers (not real hackers, just ppl who do stuff on my forum) are jumping for joy! thanks so much and i really enjoy the hack..well...they do ;)

Dark_Wizard
02-01-2002, 05:05 PM
Nice hack...wish I would have seen this earlier.

Stretchr
02-04-2002, 07:04 AM
FYI, this hack has also been tested and works as written on vB 2.2.2 final.

rstark
05-23-2002, 03:35 AM
For VB version 2.2.5, it doesn't show the (COPPA) Users Awaiting Moderation group in the table.