Moderators for Upload Approval (1.4.x) Moderators for Upload Approval (1.4.x)
 

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]

Main Menu

Moderators for Upload Approval (1.4.x)

Started by Abbas Ali, December 01, 2005, 11:23:37 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Abbas Ali

Here is the moderators for upload approval mod for cpg 1.4.x. Admin can assign moderator group for each album to approve the uploads of that album from album properties page.

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 place
modifyalb.php, db_input.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.

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.

The newly added lines are marked with
######### Added ##########
some code
#########################

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

This will make it easy for you too see the diff and modify your scripts.

For those who are using themes other then classic, they will have to modify their respective theme file. In the pack the modifications are for classic theme.

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


Abbas.


Note: Please download moderator1.1.zip
Chief Geek at Ranium Systems

rootyb

#1
Hiya,

I tried installing this mod, and I'm fairly certain I followed all of your directions. Once I got it installed, I tried to set a mod group for one of my albums. I selected the group and hit "Update album", and it took me to a screen that said "no upate needed". Above that was a block that said "You are running Coppermine 1.5.0 (alpha) which is only meant for very experienced users - this version comes without support nor any warranties. Use it at your own risk or downgrade to the latest stable version if you need support!"

Thing is, I'm running 1.4.2.

Also, I'm using SMF Bridging. Could that be causing this problem?

Thanks!


/edit: Okay, got rid of the "You are running Coppermine 1.5.0..." message. Went in and manually added the changes to my init.inc.php file. I'll try manually adding all of the changes instead of uploading, and post back my results.


/edit2: Alright, manually edited the files, but when I choose a moderating group and hit "update album", it still says "no update needed", and doesn't save the setting.

Abbas Ali

I think you missed db_input.php modifications. Please make sure that you have modified/replaced db_input.php file.

Also from where did you downloaded cpg? cpg1.5.0 is the devel version and you must have got it from cvs. I recommend you use the stable 1.4.2 version.
Chief Geek at Ranium Systems

rootyb

#3
Nope, didn't miss DB_Input. I've tried it several times, now.

Also, I'm not using 1.5.0. I'm on 1.4.2. All of the files you uploaded are marked 1.5.0, though. Maybe that's my issue?

Also, I'm not using the classic theme. Using caliSkinV6. I missed that part of the directions, and didn't mod my theme file directly. Not sure what file(s) to edit in my theme folder, though.



From (for example) the header of the db_input file in your zip:

Quote********************************************
  Coppermine version: 1.5.0
  $Source: /cvsroot/coppermine/devel/db_input.php,v $
  $Revision: 1.53 $
  $Author: gaugau $
  $Date: 2005/11/28 07:24:06 $
**********************************************/

Abbas Ali

Actually i picked the files from devel branch, hence my mistake. Anyways it shouldn't afftect the working of mod. But for safety i have uploaded moderator1.1.zip in my first post. Please see if this works.
Chief Geek at Ranium Systems

rootyb

#5
Got the new version downloaded and installed. Didn't change anything. Switched back to the default theme. That let me save the settings. Switched back to my theme. Looks like it saved the setting.

For future reference, what would someone need to edit in their theme files to make this work?


/edit: Nevermind. Looks like the setting wasn't saved.

amirw2k

#6
This is great, thanks for the upgrade !

I've got a small problem. I'm using a bridged version so a user can be a memeber of many usergroups. This causes a problem because I'm not sure how the following line is validated:

File: init.inc.php
$result = cpg_db_query("SELECT DISTINCT(aid) FROM {$CONFIG['TABLE_ALBUMS']} WHERE moderator_group='{$USER_DATA['group_id']}'");

Looks like it checks only one usergroup, and it's probably the first usergroup found. What if the user is a member of two usergroups or more? Is there any fix for this?

EDIT: To solve this problem, I replaced the above line with the following:
$result = cpg_db_query("SELECT DISTINCT(aid) FROM {$CONFIG['TABLE_ALBUMS']} WHERE moderator_group IN ".USER_GROUP_SET);

I still have some permission issues, and I'm checking the code.

Abbas Ali

#7
@amirw2k: I made the mod considering standalone version. Never intended to make it for bridged installations. If you succeed in porting the mod for bridged installation then pls put up the files here so that others are benifitted.

@rootyb: Please attach the files you are using (those 6 files). Also if you can PM me your admin un/pass then i will take a look.
Chief Geek at Ranium Systems

rootyb

Alright, here's my modded files, compressed with the directory structure in which I upload them.


Like I said, though, I'm using the SMF bridge, and the group I'm trying to setup for upload approvals is one of my SMF groups. I didn't realize that this wasn't intended for bridged situations. When I disable the bridge, it works as intended.


Sooo, I'm looking forward to seeing Amirw2k's modified files. :)

Nibbler


$moderator_group = $HTTP_POST_VARS['moderator_group'];


That should be $_POST now since this is 1.4 code.

Once you fix the multiple usergroups issue as suggested by amirw2k you'll be fine. Coppermine by default supports multiple group membership, so it's not a bridge related issue atall.

rootyb

#10
Awesome. I only needed to change that in db_input.php, right?

That, along with amirw2k's fix (partial though it may be) looks like it's working for what I need.

I've zipped up the files and attached 'em, if anyone wants to use them. It's working with my SMF bridge, and I haven't noticed any problems yet. If any come up, I'll come say so (don't count on me being able to fix it, though. I'm fairly worthless when it comes to code, but I'm learning as I have to fix stuff here and there.)

No guarantees as to its usefulness, but it's working for me. :)



/edit: Oh, also, I'll probably hit up one of my codemonkies for this, but how hard would it be to change the drop-down box to checkboxes, so you can have more than one group moderating upload approval? :)

Not at all necessary, since you can always add a new group just for approving pictures, and assign it to people that need to be in it, but being able to allow a couple of groups would be nice for bridged situations.

dazzler

Guys i am really new to this i am stuck at the making of the moderators group..... i have got the files inplace ready to use...

will i have any probs as my user database is combined with SMF?
Find your local miniclub at the  *Link Removed*

Abbas Ali

It shouldn't be a problem. But please make backups before proceeding.
Chief Geek at Ranium Systems

dazzler

Hello Abbas Ali, thank you for your response..

I went in to my My phpmyadmin... some where i ahve never had to go.. i found the dates base... i am just not sure how to Create the modorators group or what settings to use as this didnt look very simple when i had a play...

Good job i backed everything up as i have already had to restore my coppermine already thorugh playing and learning.

I am a fast learner and a few monements on your time with this would be greatfully recieved.

A quick "How to" with the creation part would see my instalation finshed.

Thanking you in advance

Daz

Oh a link to my site where i have it is www.minidirectory.co.uk/forum under the gallery tab
Find your local miniclub at the  *Link Removed*

Abbas Ali

The HOW TO is given in my very first post. In database you just need to run one query given in my first post. Read my first post carefully and follow the instructions given there.
Chief Geek at Ranium Systems

Glenn

#15
Hello,

I applied your patch and get the following error.

Parse error: parse error, unexpected ')' in /home/httpd/vhosts/domainremoved.com.au/subdomains/playerpix/httpdocs/include/init.inc.php on line 403

Please advise.

Thanks

Glenn

EDIT: For some reason some of the files did not FTP to the site - I copied them up again and things look better...

Abbas Ali

Chief Geek at Ranium Systems

andreas_

I've followed the above instructions of the first post, hopefully I did everything right.

In Album properties a new tag "Album can be moderated by" appeared, I switched it to group 'Manager'.
Unforunatelly logging on as a member of that group there's no special feature added to upload pictures or change them.
What did I wrong? For testing I changed to english language und Classic Theme.


andreas_

Sorry, my fault.. everything is working fine now.

Thanks for the mod!

Bazzah

I have been trying to get this mod to run all day, but as soon as I upload init.inc.php, all member groups other than administrators receive 'fatal error' message, and can not access the gallery. I am using a bridge between IPB and CPG 1.4.10, but I can not see how this would interfere. I have only installed a few mods, so I am pretty clueless, so any help would be greatly appreciated.