coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 permissions => Topic started by: Iced Coffee on October 25, 2006, 07:26:05 AM

Title: Disable rating for all albums except one
Post by: Iced Coffee on October 25, 2006, 07:26:05 AM
Can I disable rating for all albums (including newly created one) by default and set rating permission to one or two albums later on?

I heard I can do this by modifying MySQL database, but I don't know how. Can anyone help show me how to do this.

Thank you too much.
Title: Re: Disable rating for all albums except one
Post by: Joachim Müller on October 25, 2006, 08:17:28 AM
Quote from: Iced Coffee on October 25, 2006, 07:26:05 AM
Can I disable rating for all albums (including newly created one) by default and set rating permission to one or two albums later on?
Yes.

Quote from: Iced Coffee on October 25, 2006, 07:26:05 AM
I heard I can do this by modifying MySQL database, but I don't know how.
Sort of yes - you need to run a query on the database (using phpMyAdmin or similar). Your query should look like this:ALTER TABLE `YourCoppermineTablePrefix_albums` CHANGE `votes` `votes` ENUM( 'YES', 'NO' ) NOT NULL DEFAULT 'NO'
This will set the default for rating to 'NO' for newly added albums. However, fiddling with the database can be tricky if you don't know your way around - I don't recommend doing this if you're not absolutely sure what you're doing.
Another option would be to modify the query within delete.php that creates new albums, the corresponding line in delete.php is                    $query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos) VALUES ('$category', '" . addslashes($op['album_nm']) . "', 'NO',  '{$op['album_sort']}')";which should be replaced with                    $query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos, votes) VALUES ('$category', '" . addslashes($op['album_nm']) . "', 'NO',  '{$op['album_sort']}', 'NO')";(not tested though, please report if this works for you). Again, this applies to new albums you create from now on. Your old (existing) albums will remain as they are, either use Coppermine's user interface (album properties) to change the ability to rate one by one. If you feel adventurous, you could come up with a query (to be run in phpMyAdmin) that sets all existing albums to "no rating".
Title: Re: Disable rating for all albums except one
Post by: Iced Coffee on October 25, 2006, 01:52:09 PM
Thank you very much Gaugau. It's a great help already. I have modified the delete.php file. Could you please help with the query to set all existing album to "no rating"? I have more than 100 albums for my members now, and it would be a bit foolish if I just try to change the properties one by one. Could you please help?

QuoteIf you feel adventurous, you could come up with a query (to be run in phpMyAdmin) that sets all existing albums to "no rating".

Thank you very much.
Title: Re: Disable rating for all albums except one
Post by: Nibbler on October 25, 2006, 02:25:29 PM
UPDATE cpg_albums SET votes = 'NO'
Title: Re: Disable rating for all albums except one
Post by: Iced Coffee on October 26, 2006, 03:22:09 PM
Ooops, my MySQL said this:

QuoteError

SQL query:

UPDATE cpg_albums SET votes = 'NO'

MySQL said: Documentation
#1146 - Table 'november_cpg.cpg_albums' doesn't exist
Title: Re: Disable rating for all albums except one
Post by: Sami on October 26, 2006, 04:32:44 PM
change the cpg_ with your table prefix (look at the include/config.inc.php for your prefix)