• [MOD] - MCP (Moderator Control Panel) 5 0 5 1
Currently:  

Author Topic: [MOD] - MCP (Moderator Control Panel)  (Read 66322 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
[MOD] - MCP (Moderator Control Panel)
« 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-z0-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-z0-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

« Last Edit: February 26, 2007, 12:36:29 AM by trez »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #1 on: February 23, 2007, 03:49:30 PM »
... such modification was much looked for ...
... George, thanks for your work ... :)
Your first three "must do" before you ask a question ! ( by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: MOD: Moderator Addon ;)
« Reply #2 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.

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.412
    • View Profile
    • 4images - Image Gallery Management System
Re: MOD: Moderator Addon ;)
« Reply #3 on: February 23, 2007, 04:43:58 PM »
Good mod!
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #4 on: February 23, 2007, 09:11:47 PM »
very nice mod :!:

Offline medo007

  • Newbie
  • *
  • Posts: 29
  • Internet addict
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #5 on: February 24, 2007, 01:12:57 AM »
Thanks, nice mod!  :D
mEDO

Offline om6acw

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • My Animal's World
Re: MOD: Moderator Addon ;)
« Reply #6 on: February 24, 2007, 02:01:00 AM »
Thanks Trez, nice one  :thumbup:

Offline Jenn

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #7 on: February 24, 2007, 03:08:23 AM »
Awesome!

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #8 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

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: MOD: Moderator Addon ;)
« Reply #9 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?

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: MOD: Moderator Addon ;)
« Reply #10 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.


Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: MOD: MCP (Moderator Control Panel)
« Reply #11 on: February 25, 2007, 03:39:02 PM »
*added further customization options to the first post*

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] - MCP (Moderator Control Panel)
« Reply #12 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 ?

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] - MCP (Moderator Control Panel)
« Reply #13 on: February 26, 2007, 09:32:12 AM »
Yes.
(Please don't write whole posts in capital letters)

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] - MCP (Moderator Control Panel)
« Reply #14 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 ???

 

Post your comments here