PDA

View Full Version : Message Editing Hierarchy for 3.6


ice chrono
09-10-2007, 03:26 AM
looking for a mod to prevent moderators from editing users in a higher class.
basically
Mods>S-mods>Admins>S-Admins
s-mods can edit mods post.. but can not touch Admins and S-Admins post/topics.
and thanks in advance :D

G0F0RBR0KE
09-10-2007, 05:28 AM
I do hope someone can accomplish this.

FullyTested
09-10-2007, 10:24 AM
While this is definitely not of plugin quality, it is a quick fix to the hierarchy post edit issue.
Please note that a moderator can still edit and/or delete the thread itself.
In addition, moderators that are not assigned a forum do not count as privileged to edit posts.
I did write this quickly, so unlike my username, I haven't fully tested it. Use at your own discretion.

1). Copy and paste the following function at the end of the functions.php file:
// note: moderator usergroup only counts if user is assigned to a forum
function caneditposter($userid)
{
global $vbulletin;
static $superadmins;

$issuperadmin = false;
$issuperadmin2 = false;
$isadmin = false;
$isadmin2 = false;
$issupermod = false;
$issupermod2 = false;
$ismod = false;
$ismod2 = false;

if ($userid == $vbulletin->userinfo['userid'])
return true;

if (!is_array($superadmins))
{
$superadmins = preg_split('#\s*,\s*#s', $vbulletin->config['SpecialUsers']['superadministrators'], -1, PREG_SPLIT_NO_EMPTY);
}

if ($vbulletin->userinfo['userid'] < 1)
{
// user is a guest
return false;
}
else if (in_array($vbulletin->userinfo['userid'], $superadmins))
{
// user is a super administrator (defined in config.php) so can do anything
$issuperadmin = true;
}
else if (($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
{
$isadmin = true;
}


if ($userid < 1)
{
// user is a guest
return true;
}

$userinfo = fetch_userinfo($userid);

if (in_array($userid, $superadmins))
{
// user is a super administrator (defined in config.php) so can do anything
$issuperadmin2 = true;
}
else if ($userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
{
$isadmin2 = true;
}


if ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'])
{
$issupermod = true;
}

if ($userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'])
{
$issupermod2 = true;
}

if (!$issupermod)
{
$mod = $vbulletin->db->query_first_slave("
SELECT forumid
FROM " . TABLE_PREFIX . "moderator
WHERE userid = " . $vbulletin->userinfo['userid'] . "
LIMIT 1
");
if ($mod)
$ismod = true;
}

if (!$issupermod2)
{
$mod2 = $vbulletin->db->query_first("
SELECT forumid
FROM " . TABLE_PREFIX . "moderator
WHERE userid = $userid
LIMIT 1
");
if ($mod2)
$ismod2 = true;
}



if ($issuperadmin)
{
if ($issuperadmin2)
return false;
else
return true;
}
else if ($isadmin)
{
if ($issuperadmin2 OR $isadmin2)
return false;
else
return true;
}
else if ($issupermod)
{
if ($issuperadmin2 OR $isadmin2 OR $issupermod2)
return false;
else
return true;
}
else if ($ismod)
{
if ($issuperadmin2 OR $isadmin2 OR $issupermod2 OR $ismod2)
return false;
else
return true;
}

return false;
}

2). Locate the hook 'postbit_display_complete' in class_postbit.php and paste the following:
if ($this->post['editlink'] AND !caneditposter($this->post['userid']))
{
$this->post['editlink'] = '';
$show['ajax_js'] = false;
}
3). Locate 'verify_forum_password' in editpost.php and paste the following:
if (!caneditposter($postinfo['userid']))
print_no_permission();
4). Done!


Cheers,
FullyTested.

ice chrono
09-10-2007, 04:40 PM
I really it to not let them delete thread if made by higher user.

Paul M
09-10-2007, 05:06 PM
This already exists.

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

ice chrono
09-10-2007, 06:09 PM
you linked me to the 3.5 version :P
but im trying out the 3.6 right now.

ice chrono
09-16-2007, 02:13 AM
it did not work. my mods are editing smods and so on.
i just need a simple mod :(

DocBenny
09-17-2007, 02:28 AM
Yes we need one for versions 3.6x, the 3.5x were working but they do not work on the 3.6x. Can someone please update this. ??

dommo_g
12-23-2007, 06:11 PM
bumping this....any way to do this yet?