forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Permissions => Topic started by: Abbas Ali on December 01, 2005, 11:23:37 am

Title: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 01, 2005, 11:23:37 am
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.

Code: [Select]
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
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: rootyb on December 08, 2005, 07:23:32 pm
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 09, 2005, 06:33:25 am
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: rootyb on December 09, 2005, 12:29:44 pm
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 $
**********************************************/
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 09, 2005, 01:25:56 pm
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: rootyb on December 09, 2005, 05:01:21 pm
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: amirw2k on December 10, 2005, 04:24:00 am
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
Code: [Select]
$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:
Code: [Select]
$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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 10, 2005, 06:02:10 am
@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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: rootyb on December 10, 2005, 07:34:36 pm
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. :)
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Nibbler on December 10, 2005, 07:49:56 pm
Code: [Select]
$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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: rootyb on December 10, 2005, 10:24:22 pm
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: dazzler on February 12, 2006, 07:47:11 pm
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?
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on February 13, 2006, 06:18:47 am
It shouldn't be a problem. But please make backups before proceeding.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: dazzler on February 13, 2006, 04:06:06 pm
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
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on February 14, 2006, 06:31:57 am
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Glenn on February 26, 2006, 08:54:07 am
Hello,

I applied your patch and get the following error.

Code: [Select]
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...
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on February 27, 2006, 06:05:57 am
It means that it is working now?
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: andreas_ on October 29, 2006, 10:18:31 pm
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.

Title: Re: Moderators for Upload Approval (1.4.x)
Post by: andreas_ on October 29, 2006, 10:42:53 pm
Sorry, my fault.. everything is working fine now.

Thanks for the mod!
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Bazzah on October 30, 2006, 02:15:03 pm
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.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Nibbler on October 30, 2006, 04:09:03 pm
You should not use the files in the package directly, but apply the changes described within the files to your own files. The files included are 1.4.2 versions and should not be used.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Bazzah on October 30, 2006, 05:20:06 pm
Hi,

Thanks for your reply. I realise that, and have modified all the files. I have tried modifying them twice, incase I missed anything out, but still no luck.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Nibbler on October 30, 2006, 05:34:41 pm
Enable debug mode - that will give you a better error message.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: ZaneBG on June 03, 2007, 04:38:37 am
I want moderators can see upload approval button and they can approval user pics upload .
Can you help me please ........
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on June 04, 2007, 07:00:10 am
The upload approval button is shown to the moderator. Did you applied the mod?
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Gephri on November 30, 2007, 10:34:29 am
I've successfully installed CPG 1.4.14, the Moderators for Upload Approval (1.4.x) database addition and the code modifications - to my CPG which is bridged to phpBB.
All works beautifully, but need to allow Moderators to approve/manager uploads into their own gallery/albums.

The problem is, I can't figure how to identify a member as a Moderator and then check to see that they have the approve/manager tools.

Do I need to overwrite your files with the upload_approval_mod.zip file supplied by rootyb -or- can you give me a little direction?

Thanks!
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 04, 2007, 06:08:37 am
Only those members are moderators whose group you have chosen on album properties page as moderators.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Gephri on December 19, 2007, 10:10:03 am
Abbas - would you recommend the following as a sensible work-around?
The Personal Galleries are a little confusing to my members because they are identified by user name rather than the organization that the member is affiliated with (user name rather than school (category) or classroom(subcategory)).

I've got Moderators for Upload Approval (1.4.x) installed and working perfectly - but, of course, gives every Moderator upload approval to all albums where I allow your mod to do so.

Does it make sense to create a unique moderator group for each school (category) or classroom(subcategory) so that someone can't mess with someone elses?  Cumbersome - but the only way I can figure to give somone enough permissions to upload and manage their own gallery/albums, without risking others.

Thanks in advance for your thoughts.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Abbas Ali on December 19, 2007, 12:57:23 pm
Yes, you should create one moderator group for each school. That should work well. Name the group something like "Moderators for School xxx".
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Gephri on December 19, 2007, 07:40:58 pm
thank you very much abbas
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: Daethian on December 28, 2008, 06:20:33 pm
I thought this was fixed but apparently I am the only one who can access the gallery after applying this mod.
Here is the link to my original post so you can see the help I was given so far. I did update my gallery and it worked fine all week. I applied this mod last night and no one can log in but me, not even the other admin.

http://forum.coppermine-gallery.net/index.php/topic,57246.0.html

I know I can revert the mod but I would really like to use it if there is a work around or fix for the log in problem.
Title: Re: Moderators for Upload Approval (1.4.x)
Post by: dogo on September 15, 2009, 04:40:08 pm
It will be helpful to update the attachment in the first post with the suggestion from Nibbler (http://forum.coppermine-gallery.net/index.php/topic,24456.msg114528.html#msg114528) about the $_POST .
So the people who want to apply the mod wont get confused when they follow the instructions for moderator1.1.