4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: trez on February 23, 2007, 03:42:43 PM

Title: [MOD] - MCP (Moderator Control Panel)
Post 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:
Code: [Select]
  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:
Code: [Select]
  else {
    if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER || $user_info['user_level'] == USER_AWAITING) {
      $HTTP_COOKIE_VARS['moderatoron'] = 0;
    }
  }

find:
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;
    }
  }
}

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_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:
Code: [Select]
if ($user_info['user_level'] != ADMIN) {
  show_admin_header();

change to:
Code: [Select]
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:
Code: [Select]
<?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:

Code: [Select]
<?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):

Code: [Select]
//          show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");

//          show_nav_option($lang['nav_images_add'], "images.php?action=addimages");

to:

Code: [Select]
          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...

Code: [Select]
         
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:

Code: [Select]
      $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&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }

insert below

Code: [Select]
      $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&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $moderator_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=removecomment&amp;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:

Code: [Select]
        "row_bg_number" => $row_bg_number,
        "admin_links" => $admin_links
      ));

replace it with:

Code: [Select]
        "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:

Code: [Select]
{if admin_links}{admin_links}{endif admin_links}
add below

Code: [Select]
{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)

Title: Re: MOD: Moderator Addon ;)
Post by: mawenzi on February 23, 2007, 03:49:30 PM
... such modification was much looked for ...
... George, thanks for your work ... :)
Title: Re: MOD: Moderator Addon ;)
Post by: trez on February 23, 2007, 03:52:44 PM
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.
Title: Re: MOD: Moderator Addon ;)
Post by: kai on February 23, 2007, 04:43:58 PM
Good mod!
Title: Re: MOD: Moderator Addon ;)
Post by: CeJay on February 23, 2007, 09:11:47 PM
very nice mod :!:
Title: Re: MOD: Moderator Addon ;)
Post by: medo007 on February 24, 2007, 01:12:57 AM
Thanks, nice mod!  :D
Title: Re: MOD: Moderator Addon ;)
Post by: om6acw on February 24, 2007, 02:01:00 AM
Thanks Trez, nice one  :thumbup:
Title: Re: MOD: Moderator Addon ;)
Post by: Jenn on February 24, 2007, 03:08:23 AM
Awesome!
Title: Re: MOD: Moderator Addon ;)
Post by: __G__ on February 24, 2007, 03:55:33 AM
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
Title: Re: MOD: Moderator Addon ;)
Post by: CeJay on February 24, 2007, 08:09:43 AM
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?
Title: Re: MOD: Moderator Addon ;)
Post by: trez on February 25, 2007, 02:55:49 PM
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.

Title: Re: MOD: MCP (Moderator Control Panel)
Post by: trez on February 25, 2007, 03:39:02 PM
*added further customization options to the first post*
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: __G__ on February 26, 2007, 03:30:39 AM
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 ?
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on February 26, 2007, 09:32:12 AM
Yes.
(Please don't write whole posts in capital letters)
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: __G__ on February 26, 2007, 11:05:04 AM
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 ???
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on February 26, 2007, 05:02:34 PM
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:

Code: [Select]
if ($user_info['user_id'] != XXX) {
  show_admin_header();

Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: __G__ on February 27, 2007, 12:02:31 AM
thx a lot trez n thx 4 da superb mod
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: shan on March 05, 2007, 06:16:06 AM
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
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on March 05, 2007, 10:33:55 AM
Parse error: syntax error, unexpected T_STRING in /home/desisub/public_html/subs/moderator/admin_global.php on line 121

repeat step 2
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: shan on March 06, 2007, 01:09:23 AM
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;
   }
}
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on March 06, 2007, 08:01:44 AM
Quote
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.
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: shan on March 06, 2007, 09:45:58 PM
but in admin cpanel i can't see the user id i only see the usernames...anywhere else to luk for it?:(
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on March 06, 2007, 10:18:13 PM
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
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Jenn on March 20, 2007, 05:43:33 PM
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.

Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on March 20, 2007, 05:56:07 PM
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
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Jenn on March 20, 2007, 06:44:27 PM
When I log in as admin on my site, at the very bottom I have a Administrator Control Panel Link.
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: trez on March 23, 2007, 09:28:02 AM
Well, just  put the moderator into a usergroup and use if_else tags
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: mato72 on August 02, 2007, 04:51:22 AM
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....
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: bjorn666 on August 30, 2007, 11:32:02 PM
Is there any way to have more than one moderator on this?
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: manurom on August 30, 2007, 11:57:46 PM
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).
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Mr_LovaLove on August 31, 2007, 12:09:59 AM
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 :)
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: m.a on November 17, 2007, 12:18:40 AM
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.


Code: [Select]
<?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:
Code: [Select]
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:
Code: [Select]
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
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: thunderstrike on November 17, 2007, 12:24:26 AM
After change - please replace 3 line:

Code: [Select]
$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);
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: baghdad4ever on December 28, 2007, 02:46:54 PM
thanks

you say

Quote
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??

Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: thunderstrike on December 28, 2007, 03:17:22 PM
Quote
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. ;)
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: inLIMITit on April 03, 2008, 09:20:14 PM
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.
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: drame 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:
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
(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
Code: [Select]
$user_info['user_id'] != XXX)must be changed to
Code: [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",to
Code: [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 id

save&close

open:
templates/yourtemplate/footer.html
find:
Code: [Select]
{cp_link}add:
Code: [Select]
{m_cp_link}
save&close
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: the0bone on April 15, 2008, 12:20:13 PM
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...

Code: [Select]
         
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:

Code: [Select]
      $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&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }

insert below
this code has changed
Code: [Select]
      elseif ($user_info['user_id'] == XXX) {
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."moderator/index.php?goto=".urlencode("comments.php?action=removecomment&amp;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.


Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Tobi.L on June 10, 2008, 10:58:13 PM
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
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Sunny C. on October 01, 2008, 03:30:24 PM
Hallo,

ich habe diese Modifikation eingebaut:
http://www.4homepages.de/forum/index.php?topic=17408.0

Macht es Sinn diese hier auch einzubauen?
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: Sunny C. on October 01, 2008, 07:27:50 PM
Alles klar,
ich dank dir ivan!
Title: Re: [MOD] - MCP (Moderator Control Panel)
Post by: mato72 on October 30, 2008, 07:54:24 AM
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