MODERATOR CONTROL PANEL (MCP) by 2XG MEDIAYes finally i've found a pleasant solution for having moderators on your site, without having to create usergroups etc.
Let's go
WHAT DOES THIS MODIt gives you the ability to have moderators who can
validate images on your site. This can be extended of course (edit images, comments, etc.) to your wishes
(Please look at the several additions at the end of this post for further customization)IS IS SECURE?Yes, because moderator won't have access to important files like "reset stats", "Settings" etc..
VERSIONS1.7.X
InstallationSimply follow the steps. No additional SQL fields are required
STEP ONEcopy the whole folder "
admin" to your harddrive, and
rename it to "
moderator". After that, upload the folder to your 4images root dir.
STEP TWOopen
yoursite.com/moderator/admin_global.phpfind: else {
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
$HTTP_COOKIE_VARS['adminon'] = 0;
}
}
change to: else {
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
$HTTP_COOKIE_VARS['moderatoron'] = 0;
}
}
find: 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;
}
}
}
change to: 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;
}
}
}
In the above code replace XXX with the userid of your user who would be the moderatorfind:if ($user_info['user_level'] != ADMIN) {
show_admin_header();
change to:if ($user_info['user_id'] != XXX) {
show_admin_header();
In the above code replace XXX again with the userid of your user who would be the moderatorSave and close admin_global.phpSTEP THREEopen
yoursite.com/moderator/index.phpfind: <?php
show_nav_header($lang['nav_categories_main']);
show_nav_option($lang['nav_categories_edit'], "categories.php?action=modifycats");
show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");
show_nav_header($lang['nav_images_main']);
show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");
show_nav_option($lang['nav_images_add'], "images.php?action=addimages");
show_nav_option($lang['nav_images_validate'], "validateimages.php?action=validateimages");
show_nav_option($lang['nav_images_check'], "checkimages.php?action=checkimages");
show_nav_option($lang['nav_images_thumbnailer'], "thumbnailer.php?action=checkthumbnails");
show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");
show_nav_header($lang['nav_comments_main']);
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");
show_nav_header($lang['nav_users_main']);
show_nav_option($lang['nav_users_edit'], "users.php?action=modifyusers");
if (!defined('USER_INTEGRATION')) {
show_nav_option($lang['nav_users_add'], "users.php?action=addusers");
}
show_nav_option($lang['nav_usergroups'], "usergroups.php?action=modifygroups");
if (!defined('USER_INTEGRATION')) {
show_nav_option($lang['nav_users_email'], "email.php?action=emailusers");
}
show_nav_header($lang['nav_general_main']);
show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");
show_nav_option($lang['nav_general_templates'], "templates.php?action=modifytemplates");
show_nav_option($lang['nav_general_backup'], "backup.php?action=modifybackups");
show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");
show_nav_option("phpinfo()", "phpinfo.php");
if (@is_dir("plugins")) {
show_nav_header("PlugIns");
$handle = @opendir("plugins/");
while ($file = @readdir($handle)) {
if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file)) {
continue;
}
$plugin_file = file("./plugins/".$file);
$plugin_file[0] = trim($plugin_file[0]);
if (preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs)) {
show_nav_option(trim($regs[1]), "./plugins/".$file);
}
else {
show_nav_option($file, "./plugins/".$file);
}
}
@closedir($handle);
}
?>
change to: <?php
// show_nav_header($lang['nav_categories_main']);
// show_nav_option($lang['nav_categories_edit'], "categories.php?action=modifycats");
// show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");
show_nav_header($lang['nav_images_main']);
// show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");
// show_nav_option($lang['nav_images_add'], "images.php?action=addimages");
show_nav_option($lang['nav_images_validate'], "validateimages.php?action=validateimages");
// show_nav_option($lang['nav_images_check'], "checkimages.php?action=checkimages");
// show_nav_option($lang['nav_images_thumbnailer'], "thumbnailer.php?action=checkthumbnails");
// show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");
// show_nav_header('DREAMBOARD');
// show_nav_option('Board Manager', "board_admin.php");
// show_nav_option('Config Board', "board_config.php");
show_nav_header($lang['nav_comments_main']);
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");
// show_nav_header($lang['nav_users_main']);
// show_nav_option($lang['nav_users_edit'], "users.php?action=modifyusers");
// if (!defined('USER_INTEGRATION')) {
// show_nav_option($lang['nav_users_add'], "users.php?action=addusers");
// }
// show_nav_option($lang['nav_usergroups'], "usergroups.php?action=modifygroups");
// if (!defined('USER_INTEGRATION')) {
// show_nav_option($lang['nav_users_email'], "email.php?action=emailusers");
// }
// show_nav_header($lang['nav_general_main']);
// show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");
// show_nav_option($lang['nav_ann_settings'], "ann_settings.php?action=modifysettings");
// show_nav_option($lang['nav_general_templates'], "templates.php?action=modifytemplates");
// show_nav_option($lang['nav_general_backup'], "backup.php?action=modifybackup");
// show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");
/* if (@is_dir("plugins")) {
show_nav_header("PlugIns");
$handle = @opendir("plugins/");
while ($file = @readdir($handle)) {
if (eregi("^\.{1,2}$", $file) || !eregi("\.php$", $file)) {
continue;
}
$plugin_file = file("./plugins/".$file);
$plugin_file[0] = trim($plugin_file[0]);
if (preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i", $plugin_file[0], $regs)) {
show_nav_option(trim($regs[1]), "./plugins/".$file);
}
else {
show_nav_option($file, "./plugins/".$file);
}
}
@closedir($handle);
}
*/
?>
save and close index.phpThats it.Now you moderator can validate images with the following link:
YOURSITE.com/4images/moderator/index.php
The login will only work for the userid (the person) you specified in step two. You as an admin will continue to
use your normal /admin/index.php - the moderator won't have access to that. And you won't have access to the /moderator/ folder,
but you don't need to have to.
-----------------------------------------------------------------------------------------------------------------------------------
Additional Options for you moderatorIf you want him to have access to more for example to edit comments or add pictures simply uncomment the regarding line in step 3.
For example, if you want him to to add images and have access to modify images simply change (in step three):
// show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");
// show_nav_option($lang['nav_images_add'], "images.php?action=addimages");
to:
show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");
show_nav_option($lang['nav_images_add'], "images.php?action=addimages");
I think the concept is understandable
Additional SECURITY for you moderator area I recommend deleting the files you commented in step three for additional security, because if he knows the filename he can access it.
For example you want to be sure that your moderator don't have access to the site "settings", even if the line in step three is
commented --> simply delete moderators/
settings.phpDo the same thing with other files, but be carefull deleting files like images.php, because it's used for 4 different actions.
-------------------------------------------------------------------------------------------------------------------------
ADDITONAL OPTION (added 25/02/2007)Allow your moderator directly to delete/edit comments from your details.phpWell, deleting and editing comments for your moderator can be very sad, if he always have to login first to his MCP (Moderator Control Panel), search the comment by ID and so on.
SO this little addition to my MOD allows your moderator to
directly delete and edit comments at the details.php (picture) Have pHun
STEP ONEopen yoursite.com/4images/moderator/index.php
Make sure those lines...
show_nav_header($lang['nav_comments_main']);
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");
... are uncommented (without a "//" on the left)
Be also sure that you haven't deleted the "comments.php" in your moderator folder.
Everything fine? Good, let's proceed....
STEP TWOopen
yoursite.com/4images/details.phpfind: $admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
insert below $moderator_links = "";
if ($user_info['user_id'] == XXX) {
$moderator_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$moderator_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
In the above code replace XXX again with the userid of your user who would be the moderatorOkay, now lets find: "row_bg_number" => $row_bg_number,
"admin_links" => $admin_links
));
replace it with: "row_bg_number" => $row_bg_number,
"admin_links" => $admin_links,
"moderator_links" => $moderator_links
));
save and close details.phpSTEP THREEopen
yoursite.com/4images/templates/yourtemplate/comment_bit.htmlfind:{if admin_links}{admin_links}{endif admin_links}
add below{if moderator_links}{moderator_links}{endif moderator_links}
save and close comment_bit.htmlThats it.Now you moderator can delete and edit comments directly from your site.
----------------------------------------------------------------------------------------------------------------------
If there are any questions feel free to write in this topic - DON'T send me PM's regarding this MOD.Feel free to browse another 25 unreleased (payed) MOD's here:
http://www.ggrec.com/mods