Moderators for Album pictures Moderators for Album pictures
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Moderators for Album pictures

Started by Abbas Ali, January 09, 2006, 09:01:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Abbas Ali

Here is the album moderators mod for cpg 1.4.x. Admin can assign moderator group for each album from album properties page.

Moderators can do following things

  • Approve uploads in that album
  • Edit/Delete pics from that album
  • Reset views counter/comments for that album

Moderators cannot edit the album itself i.e. they cannot delete the albums or edit their name/description and such other things.

Do make backups before applying this mod.

Step 1

Modify the database table cpgPrefix_albums by running following query (Use phpMyadmin or other application)
Replace Prefix with your prefix for database tables.


ALTER TABLE `cpgPrefix_albums` ADD `moderator_group` INT NOT NULL;



Step 2

Download the zip file and replace
modifyalb.php, db_input.php, index.php and editpics.php in your coppermine root folder.
english.php in lang folder
init.inc.php, functions.inc.php, themes.inc.php in include folder.
theme.php in themes/yourtheme folder (Attached theme file is for classic)

For those who are already using modified cpg or have applied some mods it is recommended to open the respective files and see the diff and then insert the appropriate code to your scripts. To make it easy i have marked all the modification with ######## characters.

Update: Everyone should make the changes manually as the attached files are of 1.4.3 version and if you replace it in the latest version then that might cause issues. If you do the changes manually then mod will work with all cpg1.4.x versions. Attached files are for cpg1.4.19. If you are using any other version then do the changes manually

For those who are using customized theme they will have to modify their respective theme.php instead of themes.inc.php
Also i have modified themes.inc.php for the sake of simplicity. The correct way would be to modify your respective theme file.

Those who are using unmodified version, it is highly recommended to download the files and replace your current files with these.

Latest file : moderator_cpg1419.1.zip


Step 2

Download the zip file and extract it. It contains the file changes.txt which has the instructions to modify the scripts. The zip also contains a theme.php (classic theme). You need to manually edit your theme file and apply the changes as given in attached theme.php. The newly added lines are marked with
######### Added ##########
some code
#########################

The modified lines are marked with
######### Modified #########
some code
#########################

If your theme file does not have that piece of code then you can copy it from themes/sample/theme.php and then make the changes.

Latest File : moderator_cpg14x.zip

P.S: Thanks to Nibbler and amirw2k for fixing bugs in previous version.


Abbas.
Chief Geek at Ranium Systems

andrewshu329

Thanks alot for this mod Abbas,
I have one question: If I've already implemented your previous mod, Moderators for upload approval for cpg 1.4.x, will this mod work alongside that? Or will i have to undo the modifications to the files before implementing this mod?

Thanks again,
Andrew
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

Abbas Ali

The files modified for both the mods are same and hence you will have to undo previous mod. If you hadn't any other mod other then my previous mod (upload approval) then it is recommended that you just replace your existing files with this one (do make backups).

Note: This mod also does upload approval.
Chief Geek at Ranium Systems

VVVas

Very-very good mod!

request: edit comment for moderator?
I am sorry for my bad english. I do not know it.
CPG 1.4.3 phpBB 2.0.19

andrewshu329

Hi Abbas,
Once again, thanks for the great mod.
However, there is one minor detail that id like to point out.

As you know, while in admin mode, you can move a user's photo from a public album into his or her private album.
This function is not available to moderators, so an admin must manually set all of the user's albums to "moderated by" "groupname".

Is it possible to make this function available?

Thanks,
Andrew

CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

VVVas

Quote from: andrewshu329 on January 15, 2006, 10:34:35 AM
As you know, while in admin mode, you can move a user's photo from a public album into his or her private album.
This function is not available to moderators, so an admin must manually set all of the user's albums to "moderated by" "groupname".

Is it possible to make this function available?
SQL-query for default `moderator_group`= groupID (Use phpMyadmin or other application).

___________________
I am sorry for my bad english. I do not know it.
I am sorry for my bad english. I do not know it.
CPG 1.4.3 phpBB 2.0.19

Abbas Ali

Quote from: andrewshu329 on January 15, 2006, 10:34:35 AM
As you know, while in admin mode, you can move a user's photo from a public album into his or her private album.
This function is not available to moderators, so an admin must manually set all of the user's albums to "moderated by" "groupname".

Is it possible to make this function available?

This is possible. But i deliberately made it like that. Anyways i am going out for a week, will discuss this after i return.
Chief Geek at Ranium Systems

Goosemoose

Any update on moving to a users gallery? The sql command would need to be run every time a user created a new album, so it's not exactly usable.

Abbas Ali

Yes....now the moderators can move the pictures to their personal galleries. Please download the newly attached moderator1.1.zip in my first post.

If you want to make changes manually then edit editpics.php

Replace


$user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid IN $albStr AND category > '".FIRST_USER_CAT."' ORDER BY title");


with


$user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid IN $albStr AND category > '".FIRST_USER_CAT."' OR category='".(FIRST_USER_CAT + USER_ID)."' ORDER BY title");



Abbas
Chief Geek at Ranium Systems

n3n

Very nice mod, tnx alot.
I do have a question. Where is the link to the image approve list ? And is it possible for
moderators to recieve an email when there are new files that need approval ?

Tnx again for the work.

Abbas Ali

The link is shown only to moderators. The code has been added to include/themes.inc.php for the same.

Email notifications are possible with some modifications in code.
Chief Geek at Ranium Systems

n3n

Ok tnx.

Would you consider implementing the email thing ? Think lots of people would like it, but i don't
have the skills to do it :(

Abbas Ali

Hmmm.... Will do it whenver i get some free time. Can't promise anything ;)
Chief Geek at Ranium Systems

n3n


gabbadude

#14
THis is an EXCELLENT mod Abbas.  Thank you for this.

I'm sorry if I missed the next question on these boards but there is soo mcuh info here that it has taken me ALL day to find this mod.

Is there any way to actually make a user a moderator of a whole CATEGORY?  Exactly with the same features above except he should be able to create albums in that category only aswell as adding to his current "User Category" Albums?

Thanks
Gabbadude!

P.S. Just thought I would let you know that I think I have found a bug(maybe just my ignorance) in the mod.  As it is probably supposed to be like this, the mod only works if the "Public Albums Upload Approval" is set to "Yes" on the group that the user is assigned to. However, this forces the moderators to approve their own uploads to their own moderated albums too.  How do you propose that we get around this?  What am I doing wrong?

Abbas Ali

Quote from: gabbadude on March 12, 2006, 02:40:31 PM
Is there any way to actually make a user a moderator of a whole CATEGORY?  Exactly with the same features above except he should be able to create albums in that category only aswell as adding to his current "User Category" Albums?

I am afraid this is not possible. This feature has been requested many times and we have incorporated it in cpgNG which is in alpha stage as of now. Can't do the same in current stable version.

Quote
P.S. Just thought I would let you know that I think I have found a bug(maybe just my ignorance) in the mod.  As it is probably supposed to be like this, the mod only works if the "Public Albums Upload Approval" is set to "Yes" on the group that the user is assigned to. However, this forces the moderators to approve their own uploads to their own moderated albums too.  How do you propose that we get around this?  What am I doing wrong?

I didn't understand this.... Moderators will approve only when "Public Albums Upload Approval" is set to "Yes"... this should be the behavior, isn't it? If "Public Albums Upload Approval" is set to "no" then there will be no pic to approve.

Yes moderators need to approve their own pics too which they upload to their moderated albums.. This can be avoided by changing some more scripts. But i am reluctant to do so. Since i want to keep the total number of files changed for this mod to as less as possible.

This mod can be improved in many ways but it will require changing a lot of scripts which i suppose is not a good idea.


Abbas
Chief Geek at Ranium Systems

n3n

Hi Abbas,

I applied this mod for the second time now to cpg 1.44 install with other mods.
The thing is that as an admin im able to assign an album to a certain group in the album properties page.
But when i login as a user from that group, i dont see any buttons or options that allow me to edit an image.

What could be the problem ? Ive tried it using multiple themes.

Joachim Müller


n3n

Hmm,tnx for the tip GauGau, just tried it, but changed nothing. Also i dont want normal users (not in the moderator group) to be able to delete any
pictures, even if they uploaded them.

Any other things that could cause the problem ?

ps. Im leaving for a few days, so it could be im not gonna reply really soon.

Abbas Ali

Make sure that you have the following code in your init.inc.php file


if (!GALLERY_ADMIN_MODE) {
  $result = cpg_db_query("SELECT DISTINCT(aid) FROM {$CONFIG['TABLE_ALBUMS']} WHERE moderator_group IN ".USER_GROUP_SET);
  if (mysql_num_rows($result)) {
    while ($row = mysql_fetch_array($result)) {
      $USER_DATA['allowed_albums'][] = $row['aid'];
    }
  }
}
Chief Geek at Ranium Systems