4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: trez on February 23, 2007, 03:42:43 PM
-
MODERATOR CONTROL PANEL (MCP) by 2XG MEDIA
Yes 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 MOD
It 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..
VERSIONS
1.7.X
Installation
Simply follow the steps. No additional SQL fields are required :)
STEP ONE
copy the whole folder "admin" to your harddrive, and rename it to "moderator". After that, upload the folder to your 4images root dir.
STEP TWO
open
yoursite.com/moderator/admin_global.php
find:
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 moderator
find:
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 moderator
Save and close admin_global.php
STEP THREE
open
yoursite.com/moderator/index.php
find:
<?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.php
Thats 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 moderator
If 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.php
Do 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.php
Well, 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 ONE
open 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 TWO
open
yoursite.com/4images/details.php
find:
$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 moderator
Okay, 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.php
STEP THREE
open
yoursite.com/4images/templates/yourtemplate/comment_bit.html
find:
{if admin_links}{admin_links}{endif admin_links}
add below
{if moderator_links}{moderator_links}{endif moderator_links}
save and close comment_bit.html
Thats 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 (http://www.ggrec.com/mods)
-
... such modification was much looked for ...
... George, thanks for your work ... :)
-
Thanks :) I've just done it for myself and decided to share it.
On monday i will publicate further modification wich will allow your moderators to have a direct link to the moderator panel after they login to the regular site, directrly edit/delete images from the regular site (if enabled for mod's) etc ... just give me some time to test it first on my site.
-
Good mod!
-
very nice mod :!:
-
Thanks, nice mod! :D
-
Thanks Trez, nice one :thumbup:
-
Awesome!
-
hi i dont see those lines to edit in my admin global.php is it cause i updated from 1.7.3 to 1.7.4 ??? i can also attach my admin global.php here lemme know bro and yea thanks a lot i was lookin for this mod from long time back thanks a million
-
is it cause i updated from 1.7.3 to 1.7.4 ???
I am going to assume this works for 1.7.4 by the date of when this was posted.
If I am wrong, Trez do you know what versions this works on?
-
hi i dont see those lines to edit in my admin global.php is it cause i updated from 1.7.3 to 1.7.4 ??? i can also attach my admin global.php here lemme know bro and yea thanks a lot i was lookin for this mod from long time back thanks a million
Well, those lines have to exist :roll:
Please post your admin_global.php (as code) and i will have a look at it.
-
*added further customization options to the first post*
-
Bro tez sorry abt that i was lookin in totally diffrent file GOD I AM SO STUPID SOMETIMES GOOD THAT I DOUBLE CHECK BEFORE UPLOADING THE FILE HERE AND WASTING UR FURTHER TIME I AM SORRY BRO THANKS I WILL ADD THIS MOD TODAY SO BRO FOR MULTIPLE MODERATORS ? WE JUST KEEP HAVE TO PUT THE USER ID IN THAT XX ?
-
Yes.
(Please don't write whole posts in capital letters)
-
bro just a lil confusion so to add multiple mod do i have to do this in admin_global.php
if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
Just copy paste these lines twice the one with xxx ???
-
bro just a lil confusion so to add multiple mod do i have to do this in admin_global.php
if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
if ($user_info['user_id'] != XXX && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
Just copy paste these lines twice the one with xxx ???
There is maybe an easier way, but your way can work too. Just don't forget to repeat this step too:
if ($user_info['user_id'] != XXX) {
show_admin_header();
-
thx a lot trez n thx 4 da superb mod
-
Hey guys im getting this parse error..why?:S
Parse error: syntax error, unexpected T_STRING in /home/desisub/public_html/subs/moderator/admin_global.php on line 121
-
Parse error: syntax error, unexpected T_STRING in /home/desisub/public_html/subs/moderator/admin_global.php on line 121
repeat step 2
-
Gey trez im stil getting the same error:S heres my code:
if (defined('ADMIN_SAFE_LOGIN') && ADMIN_SAFE_LOGIN == 1) {
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;
}
else {
if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
$HTTP_COOKIE_VARS['moderatoron'] = 0;
}
}
if (!isset($HTTP_COOKIE_VARS['moderatoron']) || $HTTP_COOKIE_VARS['moderatoron'] == 0) {
$user_info['user_level'] = GUEST;
}
else {
if ($user_info['user_id'] != dj shan && $user_info['user_level'] == USER && isset($HTTP_POST_VARS['loginusername'])) {
setcookie("moderatoron", 1, 0, '/');
$HTTP_COOKIE_VARS['moderatoron'] = 1;
}
}
}
if (isset($HTTP_POST_VARS['goback']) || isset($HTTP_GET_VARS['goback'])) {
$back_url = $site_sess->get_session_var('back_url');
if (!empty($back_url)) {
$site_sess->drop_session_var('back_url');
redirect($back_url);
exit;
}
}
-
if ($user_info['user_id'] != dj shan && $user_info['user_level']
What's that? You need to use user ID's (Numbers). Replace the name by his user id (number) and you won't have problems.
-
but in admin cpanel i can't see the user id i only see the usernames...anywhere else to luk for it?:(
-
move the mouse over the username in your ACP, the number at the end of the link is the user id. Yopu can do that on your regular page also.
Example:
http://www.YOURSITE.com/member.php?action=showprofile&user_id=6480
-
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.
-
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.
I don't understand what you mean
-
When I log in as admin on my site, at the very bottom I have a Administrator Control Panel Link.
-
Well, just put the moderator into a usergroup and use if_else tags
-
Ok, have a question.
problem:
If i use the direkt-Url like 4images/moderator I could not log in.
I have first to log-in on the normal 4images-gallery...
And if I log-in, I could not edit something... Nothig happens.
In MSP I could do this, bt not exactly on gallery...
HOW to do these If-Else to show the Admin-Controlpanels down in the footer???
I installed the mod completly, no eror-messages...
Using 1.7.4
Please help me....
-
Is there any way to have more than one moderator on this?
-
Hello;
look at there (in spanish language): [MOD] Incorporar Moderadores en la galería (http://www.4homepages.de/forum/index.php?topic=17155.0)
It is not really difficult to understand. Otherwise, excitex2 is able to translate his MOD, and is actually online (http://www.4homepages.de/forum/index.php?action=profile;u=3616).
-
Well, its easy to transleted to english
also there is english but its translated by google ! which is not good to copy and past !
its better to copy the spanish and copy it to ur folders
u only have to know these words:
Añade debajo -> Add after
Añade arriba -> Add before
Cambia a: -> Replace to:
this help i got from user "ccsakuweb"
with this only this help i did the mod also u migh need to add something later
but first install the mod then will see what is missing :)
-
Hi trez,
danke für den Mod.
ich glaube, wenn man den Moderator validateimages.php frei gibt, dann muss man bei der Datei moderator/validateimages.php kleine änderung auch machen:
Es korregiert die falsche adressierung bei der freigeschaltete Bilder, dass als link bei der E-Mail (Image Validation Results) gesendet wird.
<?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);
}
*/
?>
In Datei moderator/validateimages.php Finde Code:
USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_allowemails = ($row['user_allowemails']);
$recipient_email = ($row['user_email']);
$recipient_name = ($row['user_name']);
$cut_url = str_replace("admin", "", $script_url);
$image_url = $cut_url."details.php?".URL_IMAGE_ID."=".$image_id."";
replace it with:
USERS_TABLE." WHERE user_id = $user_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_allowemails = ($row['user_allowemails']);
$recipient_email = ($row['user_email']);
$recipient_name = ($row['user_name']);
$cut_url = str_replace("moderator", "", $script_url);
$image_url = $cut_url."details.php?".URL_IMAGE_ID."=".$image_id."";
Damit wird dann die E-Mails mit richtige Adresse gesendet.
Danke noch mal für den Mod.
m.a
-
After change - please replace 3 line:
$user_allowemails = $row[$user_table_fields['user_allowemails']];
$recipient_email = (stripslashes(trim($row[$user_table_fields['user_email']])));
$recipient_name = format_text(trim($row['user_name']), 2);
-
thanks
you say
In the above code replace XXX again with the userid of your user who would be the moderator
if i have more than one moderator
how can i do??
-
if i have more than one moderator
Use $user_info['user_level'] or each $user_info['user_id'] . No usergroups exist for moderator in 4images. ;)
-
Hallo,
kann man diesen Mod auch so einstellen, dass der Moderator dann nur in einer Kategorie moderieren kann? Heißt in Kategorie X kann er Bilder bearbeiten oder löschen, aber in den Kategorien y und z nicht.
-
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:
$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:
$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
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
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:
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
if ($user_info['user_level'] != ADMIN) {
show_admin_header();
don't change to:
if ($user_info['user_id'] != XXX) {
show_admin_header();
but:
if ($user_info['user_mod'] != 1) {
show_admin_header();
save and close admin_global.php
STEP 3
open admin/users.php
find:
show_radio_row($lang['field_invisible'], "user_invisible", $user_row['user_invisible']);
addbelow:
show_radio_row($lang['field_moderator'], "user_mod", $user_row['user_mod']);
find:
$user_invisible = intval($HTTP_POST_VARS['user_invisible']);
addbelow:
$user_mod = intval($HTTP_POST_VARS['user_mod']);
find:
$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:
$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:
$lang['field_invisible']
addbelow:
$lang['field_moderator'] = "Moderator";
save and close as usual
Thats it
(http://img529.imageshack.us/img529/205/moderatorsh1.th.jpg) (http://img529.imageshack.us/my.php?image=moderatorsh1.jpg)
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
$user_info['user_id'] != XXX)
must be changed to
$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:
"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:
"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
"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",
to
"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 id
save&close
open:
templates/yourtemplate/footer.html
find:
{cp_link}
add:
{m_cp_link}
save&close
-
With some minor changes you don't need to change the template files
ADDITONAL OPTION (added 25/02/2007)
Allow your moderator directly to delete/edit comments from your details.php
Well, 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 ONE
open 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 TWO
open
yoursite.com/4images/details.php
find:
$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
this code has changed
elseif ($user_info['user_id'] == XXX) {
$admin_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> ";
$admin_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 moderator
Okay, now lets find:
this is all not needed
replace it with:
save and close details.php
STEP THREE
this is all not needed
Thats it.
Now you moderator can delete and edit comments directly from your site.
-
Was hat diese Mod für einen Sinn, also was macht diese Mod?
Ist das einsetzbar mit dieser: [MOD] Moderators for 4images gallery : http://www.4homepages.de/forum/index.php?topic=17408.0
-
Hallo,
ich habe diese Modifikation eingebaut:
http://www.4homepages.de/forum/index.php?topic=17408.0
Macht es Sinn diese hier auch einzubauen?
-
Alles klar,
ich dank dir ivan!
-
Es tut mir leid, ich hab´s immer noch nicht gerafft wie man den Link in den Footer bekommt. Also dem "Admin Control Panel"-Link wenn man sich eben als Admin anmeldet.
Ich würde s gerne auch für meine Moderatoren anbieten, dass sie ihren "Moderator Controll Panel"-Link im Footer finden...
Wo muss ich denn da die if/else einsetzen?
Nutze die 1.7.4-Version
I´m sorry, I don´t understand how to put an "Moderator Controll Panel"-Link into the footer, if a moderator logging in...
Hope you can help me...
Using 1.7.4