Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2 3 4 5 ... 11   Go Down

Author Topic: Moderators for Album pictures  (Read 158922 times)

0 Members and 1 Guest are viewing this topic.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Moderators for Album pictures
« on: January 09, 2006, 09:01:58 am »

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.

Code: [Select]
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.
« Last Edit: May 14, 2009, 05:44:34 am by Abbas Ali »
Logged
Chief Geek at Ranium Systems

andrewshu329

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
    • sasphotos.net
Re: Moderators for Album pictures
« Reply #1 on: January 14, 2006, 02:05:11 pm »

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
Logged
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #2 on: January 14, 2006, 05:53:27 pm »

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.
Logged
Chief Geek at Ranium Systems

VVVas

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 2
    • www.VVVas.ru
Re: Moderators for Album pictures
« Reply #3 on: January 14, 2006, 11:37:59 pm »

Very-very good mod!

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

andrewshu329

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
    • sasphotos.net
Re: Moderators for Album pictures
« Reply #4 on: January 15, 2006, 10:34:35 am »

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

Logged
CPG 1.4.2
Apache 2.0.54
PHP 5.0.5
MySql 4.1

VVVas

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 2
    • www.VVVas.ru
Re: Moderators for Album pictures
« Reply #5 on: January 15, 2006, 03:31:16 pm »

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.
Logged
I am sorry for my bad english. I do not know it.
CPG 1.4.3 phpBB 2.0.19

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #6 on: January 16, 2006, 06:10:15 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.
Logged
Chief Geek at Ranium Systems

Goosemoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Moderators for Album pictures
« Reply #7 on: February 26, 2006, 06:19:56 am »

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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #8 on: February 28, 2006, 12:01:46 pm »

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

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

Code: [Select]
$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
Logged
Chief Geek at Ranium Systems

n3n

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 173
Re: Moderators for Album pictures
« Reply #9 on: March 06, 2006, 11:33:10 pm »

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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #10 on: March 07, 2006, 06:54:57 am »

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.
Logged
Chief Geek at Ranium Systems

n3n

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 173
Re: Moderators for Album pictures
« Reply #11 on: March 07, 2006, 07:00:22 am »

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 :(
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #12 on: March 07, 2006, 07:05:02 am »

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

n3n

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 173
Re: Moderators for Album pictures
« Reply #13 on: March 07, 2006, 07:29:02 am »

Great :)
Logged

gabbadude

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Moderators for Album pictures
« Reply #14 on: March 12, 2006, 02:40:31 pm »

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?
« Last Edit: March 12, 2006, 04:32:46 pm by gabbadude »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #15 on: March 13, 2006, 06:40:23 am »

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
Logged
Chief Geek at Ranium Systems

n3n

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 173
Re: Moderators for Album pictures
« Reply #16 on: April 13, 2006, 05:54:27 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Moderators for Album pictures
« Reply #17 on: April 14, 2006, 09:56:47 am »

Logged

n3n

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 173
Re: Moderators for Album pictures
« Reply #18 on: April 14, 2006, 11:55:07 am »

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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Moderators for Album pictures
« Reply #19 on: April 15, 2006, 08:46:51 am »

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

Code: [Select]
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'];
    }
  }
}
Logged
Chief Geek at Ranium Systems
Pages: [1] 2 3 4 5 ... 11   Go Up
 

Page created in 0.054 seconds with 21 queries.