1
Mods & Plugins (Releases & Support) / Re: [MOD] - MCP (Moderator Control Panel)
« on: April 07, 2008, 02:30:06 PM »
i made a little change of the mod and a few files, so i can make users to mods in the acp...
i added a column to USERS_TABLE
named:
user_mod tinyint(1) standard: 0
HOW TO:
STEP 1
open include/sessions.php
find:
Change to:
save and close sessions.php
STEP 2
open admin_global.php
don't change
to
BUT change to:
Same With
don't change to:
but:
save and close admin_global.php
STEP 3
open admin/users.php
find:
addbelow:
find:
addbelow:
find:
change to:
save and close users.php
STEP 4:
open lang/yourlanguage/admin.php
find:
addbelow:
save and close as usual
Thats it

hope i haven't forgotten anything...
it works fine with my 4images installation (1.7.6)
in the admin controlpanel u've got a new option if u edit a user
if u select the checkbox the user will be an moderator and can use the moderator control panel....
if u have made the:
ADDITONAL OPTION (added 25/02/2007)
Allow your moderator directly to delete/edit comments from your details.php
then u have to change it like admin_global.php was changed --> means
would be glad to receive comments
EDIT:
its quite easy
just open:
includes/page_header.php
find:
if u don't use my modification with the extra table field user_mod, but the original u have to change
save&close
open:
templates/yourtemplate/footer.html
find:
save&close
i added a column to USERS_TABLE
named:
user_mod tinyint(1) standard: 0
HOW TO:
STEP 1
open include/sessions.php
find:
Code: [Select]
$user_table_fields = array(
"user_id" => "user_id",
"user_level" => "user_level",
"user_name" => "user_name",
"user_password" => "user_password",
"user_email" => "user_email",
"user_showemail" => "user_showemail",
"user_allowemails" => "user_allowemails",
"user_invisible" => "user_invisible",
"user_joindate" => "user_joindate",
"user_activationkey" => "user_activationkey",
"user_lastaction" => "user_lastaction",
"user_location" => "user_location",
"user_lastvisit" => "user_lastvisit",
"user_comments" => "user_comments",
"user_homepage" => "user_homepage",
"user_icq" => "user_icq"
);
Change to:
Code: [Select]
$user_table_fields = array(
"user_id" => "user_id",
"user_level" => "user_level",
"user_name" => "user_name",
"user_password" => "user_password",
"user_email" => "user_email",
"user_showemail" => "user_showemail",
"user_allowemails" => "user_allowemails",
"user_invisible" => "user_invisible",
"user_joindate" => "user_joindate",
"user_activationkey" => "user_activationkey",
"user_lastaction" => "user_lastaction",
"user_location" => "user_location",
"user_lastvisit" => "user_lastvisit",
"user_comments" => "user_comments",
"user_homepage" => "user_homepage",
"user_icq" => "user_icq",
"user_mod" => "user_mod"
);
save and close sessions.php
STEP 2
open admin_global.php
don't change
Code: [Select]
if (!isset($HTTP_COOKIE_VARS['adminon']) || $HTTP_COOKIE_VARS['adminon'] == 0) {
$user_info['user_level'] = GUEST;
}
else {
if ($user_info['user_level'] != GUEST && $user_info['user_level'] == ADMIN && isset($HTTP_POST_VARS['loginusername'])) {
setcookie("adminon", 1, 0, '/');
$HTTP_COOKIE_VARS['adminon'] = 1;
}
}
}
to
Code: [Select]
if (!isset($HTTP_COOKIE_VARS['moderatoron']) || $HTTP_COOKIE_VARS['moderatoron'] == 0) {
$user_info['user_level'] = GUEST;
}
else {
if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
setcookie("moderatoron", 1, 0, '/');
$HTTP_COOKIE_VARS['moderatoron'] = 1;
}
}
}
BUT change to:
Code: [Select]
if (!isset($HTTP_COOKIE_VARS['moderatoron']) || $HTTP_COOKIE_VARS['moderatoron'] == 0) {
$user_info['user_level'] = GUEST;
}
else {
if ($user_info['user_mod'] != 1 && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
setcookie("moderatoron", 1, 0, '/');
$HTTP_COOKIE_VARS['moderatoron'] = 1;
}
}
}
Same With
Code: [Select]
if ($user_info['user_level'] != ADMIN) {
show_admin_header();
don't change to:
Code: [Select]
if ($user_info['user_id'] != XXX) {
show_admin_header();
but:
Code: [Select]
if ($user_info['user_mod'] != 1) {
show_admin_header();
save and close admin_global.php
STEP 3
open admin/users.php
find:
Code: [Select]
show_radio_row($lang['field_invisible'], "user_invisible", $user_row['user_invisible']);
addbelow:
Code: [Select]
show_radio_row($lang['field_moderator'], "user_mod", $user_row['user_mod']);
find:
Code: [Select]
$user_invisible = intval($HTTP_POST_VARS['user_invisible']);
addbelow:
Code: [Select]
$user_mod = intval($HTTP_POST_VARS['user_mod']);
find:
Code: [Select]
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq'".$additional_sql."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
change to:
Code: [Select]
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_level")." = $user_level, ".get_user_table_field("", "user_name")." = '$user_name',$passinsert ".get_user_table_field("", "user_email")." = '$user_email', ".get_user_table_field("", "user_showemail")." = $user_showemail, ".get_user_table_field("", "user_allowemails")." = $user_allowemails, ".get_user_table_field("", "user_invisible")." = $user_invisible, ".get_user_table_field("", "user_joindate")." = $user_joindate, ".get_user_table_field("", "user_lastaction")." = $user_lastaction, ".get_user_table_field("", "user_homepage")." = '$user_homepage', ".get_user_table_field("", "user_icq")." = '$user_icq', ".get_user_table_field("", "user_mod")." = $user_mod ".$additional_sql."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
save and close users.php
STEP 4:
open lang/yourlanguage/admin.php
find:
Code: [Select]
$lang['field_invisible']
addbelow:
Code: [Select]
$lang['field_moderator'] = "Moderator";
save and close as usual
Thats it

hope i haven't forgotten anything...
it works fine with my 4images installation (1.7.6)
in the admin controlpanel u've got a new option if u edit a user
if u select the checkbox the user will be an moderator and can use the moderator control panel....
if u have made the:
ADDITONAL OPTION (added 25/02/2007)
Allow your moderator directly to delete/edit comments from your details.php
then u have to change it like admin_global.php was changed --> means
Code: [Select]
$user_info['user_id'] != XXX)
must be changed toCode: [Select]
$user_info['user_mod'] != 1
would be glad to receive comments
EDIT:
trez
Is there away to add a moderator control panel on the index page like the admins have? How would I go about adding that for easier access?
Thanks again, this has made my job much easier, in modding.
its quite easy
just open:
includes/page_header.php
find:
Code: [Select]
"cp_link" => ($user_info['user_level'] != ADMIN) ? "" : "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php")."\">Admin Control Panel</a>]</p>\n",
addbelow:Code: [Select]
"m_cp_link" => ($user_info['user_mod'] != 1) ? "" : "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php")."\">Moderator Control Panel</a>]</p>\n",
IMPORTANT:if u don't use my modification with the extra table field user_mod, but the original u have to change
Code: [Select]
"m_cp_link" => ($user_info['user_mod'] != 1) ? "" : "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php")."\">Moderator Control Panel</a>]</p>\n",
toCode: [Select]
"m_cp_link" => ($user_info['user_id'] == XXX) ? "" : "\n<p align=\"center\">[<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php")."\">Moderator Control Panel</a>]</p>\n",
XXX replace with user idsave&close
open:
templates/yourtemplate/footer.html
find:
Code: [Select]
{cp_link}
add:Code: [Select]
{m_cp_link}
save&close