Hiding non-category albums Hiding non-category albums
 

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

Hiding non-category albums

Started by angey, September 05, 2014, 08:56:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

angey

Hi there! I have a gallery that has categories and unsorted albums on the front page. Those random albums don't belong to any category and basically ruin the front page. Since there are about 60 pages of them which mostly are empty, I can't hide them one by one since it'd take a big amount of time. So I'm wondering, is there any way to hide all these albums all at once from the front page? I tried editing the breadcrumb/lastalb,2/catlist/alblist/lastup/onlinestats and deleted "alblist", which made all those albums go away, but then the albums in all of my categories disappeared too. So how do I hide all these albums simultaneously? Hope you can help out!  :)

Αndré

If I understood correctly, you want to "hide" the empty albums that don't belong to any category, right? Do you actually want to hide them (I assume by setting the permissions accordingly) or rather delete them completely?

angey

I'd like to hide those albums, some of them are empty and some aren't. The empty ones can't be deleted for some reason, they were transferred from another gallery of mine and just show an error when I try to delete them. But basically I'm wondering if it is possible to hide or make those albums unseen for visitors.

Αndré

So you want to delete the empty albums and hide the non-empty albums in the root category, right? I'll create SQL statements which will do this for you. As they're executed with a third party tool, like via phpMyAdmin, there won't be any issues deleting the albums you get error messages in Coppermine for. I just need to know what exactly you need.

angey

Yes that sounds about right! Will I be able to hide/delete several albums at once, or do I have to do them one by one?

Αndré

The SQL query does it all at once. Alternatively you could also change this with a GUI (e.g. phpMyAdmin) for each album separately, but in this case you could also use Coppermine to change the settings accordingly ;)

angey

"Alternatively you could also change this with a GUI (e.g. phpMyAdmin) for each album separately" Sorry but I have no idea what this means. I just hope you can help me fix the albums issue that a newbie like me could handle.

Αndré

Download the attached file, extract it, upload the hide_delete.php file to your gallery root (e.g. with FileZilla) and visit it with your browser. It will return "Done" when finished. I suggest to create a backup of your MySQL database before you run the script.

angey

It worked, thank you so much!!  :)  ;)

Αndré

Marking thread accordingly. Next time, please do that yourself as explained in the board rules.

sindbad5

I had about 260 empty albums in the gallery root and used the hide_delete.php to get rid of them. After about a second all of them were gone. That was quick. Are they hidden or deleted?

Tom   

Αndré

Empty albums will be deleted:
cpg_db_query("DELETE FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = '0' AND aid NOT IN (SELECT aid FROM {$CONFIG['TABLE_PICTURES']})");

Albums with pictures will be hidden by setting the visibility to "me only":
cpg_db_query("UPDATE {$CONFIG['TABLE_ALBUMS']} SET visibility = owner + ".FIRST_USER_CAT." WHERE category = '0'");