Disabling Moderator Inheritance
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: Disabling Moderator Inheritance
Sorry for the late response (have been spending time fixing up this server and various other things).
Unfortunately, there's not really an easy way to do this, and be sure you've got all cases (thanks to MyBB for not centralising/abstracting this stuff).

It does seem to be weird that MyBB does inheritance in both cache build and when displaying moderators (grandfathered code perhaps?), but oh well...
I'd probably just try tracing data sources in this case.  That is, do a search for $cache->read("moderators"); and $cache->read('moderators'); across all files:

Code:
1
2
3
4
5
6
forumdisplay.php
	Line 127: 	$moderatorcache = $cache->read("moderators");
index.php
	Line 316: 	$moderatorcache = $cache->read("moderators");
inc/functions.php
	Line 316:  $modcache = $cache->read('moderators');

And then a search for $moderatorcache

Code:
1
2
3
4
5
6
7
8
9
10
forumdisplay.php (3 hits)
	Line 127: 	$moderatorcache = $cache->read("moderators");
	Line 183: 	if(is_array($moderatorcache[$mfid]))
	Line 186: 		foreach($moderatorcache[$mfid] as $modtype)
inc/functions_forumlist.php (3 hits)
	Line 21: 	global $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;
	Line 294: 					if(is_array($moderatorcache[$mfid]))
	Line 297: 						foreach($moderatorcache[$mfid] as $modtype)
index.php (1 hits)
	Line 316: 	$moderatorcache = $cache->read("moderators");


And maybe double check that the table isn't being queried directly:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Search "TABLE_PREFIX."moderators" (12 hits in 6 files)
admin/modules/forum/management.php (3 hits)
	Line 1828: 				FROM ".TABLE_PREFIX."moderators m 
	Line 1837: 				FROM ".TABLE_PREFIX."moderators m 
	Line 2465: 			FROM ".TABLE_PREFIX."moderators m
inc/class_datacache.php (2 hits)
	Line 464: 			FROM ".TABLE_PREFIX."moderators m
	Line 485: 			FROM ".TABLE_PREFIX."moderators m
install/resources/upgrade3.php (3 hits)
	Line 721: 	$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators CHANGE mid mid smallint unsigned NOT NULL auto_increment;");
	Line 722: 	$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators CHANGE fid fid smallint unsigned NOT NULL;");
	Line 723: 	$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators CHANGE uid uid int unsigned NOT NULL;");
install/resources/upgrade5.php (2 hits)
	Line 170: 		$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators DROP canmovetononmodforum;");
	Line 172: 	$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators ADD canmovetononmodforum char(3) NOT NULL default '' AFTER canmanagethreads;");
report.php (1 hits)
	Line 83: 			FROM ".TABLE_PREFIX."moderators m
showteam.php (1 hits)
	Line 48: 		FROM ".TABLE_PREFIX."moderators m


Search "select("moderators"" (11 hits in 4 files)
admin/modules/forum/management.php (6 hits)
	Line 267: 	$query = $db->simple_select("moderators", "*", "mid='".intval($mybb->input['mid'])."'");
	Line 1805: 	$query = $db->simple_select("moderators", "*", "id='{$modid}' AND isgroup = '{$isgroup}' AND fid='{$fid}'");
	Line 1845: 		$query = $db->simple_select("moderators", "*", "id='{$mod['id']}' AND isgroup='0'");
	Line 1935: 		$query = $db->simple_select("moderators", "*", "fid='$fid' AND isgroup='0'");
	Line 1944: 			$query = $db->simple_select("moderators", "*", "fid != '$fid' AND id IN ($mod_list) AND isgroup='0'");
	Line 2110: 				$query = $db->simple_select("moderators", "id", "id='".$newmod['id']."' AND fid='".$fid."' AND isgroup='{$isgroup}'", array('limit' => 1));
inc/functions.php (2 hits)
	Line 1403: 		$query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND fid='$fid'");
	Line 1415: 		$query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND {$sql}");
modcp.php (1 hits)
	Line 49: 	$query = $db->simple_select("moderators", "*", "id='{$mybb->user['uid']}' AND isgroup = '0'");
search.php (2 hits)
	Line 235: 		$query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");
	Line 638: 		$query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");


Search "query("moderators"" (8 hits in 3 files)
admin/modules/forum/management.php (4 hits)
	Line 317: 			$db->update_query("moderators", $update_array, "mid='".intval($mybb->input['mid'])."'");
	Line 1844: 		$db->delete_query("moderators", "mid='{$mid}'");
	Line 1975: 		$db->delete_query("moderators", "fid='{$fid}' {$delquery}");
	Line 2125: 					$mid = $db->insert_query("moderators", $new_mod);
admin/modules/user/users.php (3 hits)
	Line 1625: 			$db->delete_query("moderators", "id='{$user['uid']}' AND isgroup = '0'");
	Line 1830: 				$db->delete_query("moderators", "id='{$source_user['uid']}' AND isgroup = '0'");
	Line 2438: 								$db->delete_query("moderators", "id='{$user['uid']}' AND isgroup = '0'");
inc/tasks/userpruning.php (1 hits)
	Line 72: 		$db->delete_query("moderators", "id IN({$uid_list}) AND isgroup='0'");


Search "TABLE_PREFIX.'moderators" (0 hits in 0 files)
Search "select('moderators'" (0 hits in 0 files)
Search "query('moderators'" (0 hits in 0 files)


You probably don't need to bother with the admin/* or install/* files.
Otherwise, I'd double check all the files/places above to see if they're consistent.

I think you've got all the main ones.  I haven't checked all of the above, but it looks like report.php may need a slight change (though it's probably not that important).
Hopefully that covers all the cases - after which, I'd just do some testing then use it.
Hope that helps.


My Blog
(This post was last modified: 07-04-2011 11:25 AM by ZiNgA BuRgA.)
07-04-2011 11:23 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Disabling Moderator Inheritance - wnd - 07-02-2011, 07:16 AM
RE: Disabling Moderator Inheritance - wnd - 07-02-2011, 11:02 AM
RE: Disabling Moderator Inheritance - ZiNgA BuRgA - 07-04-2011 11:23 AM

 Standard Tools
Forum Jump: