forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: angey on September 05, 2014, 08:56:41 pm

Title: Hiding non-category albums
Post by: angey on September 05, 2014, 08:56:41 pm
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!  :)
Title: Re: Hiding non-category albums
Post by: Αndré on September 06, 2014, 03:12:41 pm
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?
Title: Re: Hiding non-category albums
Post by: angey on September 06, 2014, 09:42:07 pm
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.
Title: Re: Hiding non-category albums
Post by: Αndré on September 07, 2014, 01:27:24 pm
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.
Title: Re: Hiding non-category albums
Post by: angey on September 07, 2014, 01:51:29 pm
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?
Title: Re: Hiding non-category albums
Post by: Αndré on September 07, 2014, 02:20:14 pm
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 ;)
Title: Re: Hiding non-category albums
Post by: angey on September 07, 2014, 04:09:31 pm
"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.
Title: Re: Hiding non-category albums
Post by: Αndré on September 08, 2014, 02:40:03 pm
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.
Title: Re: Hiding non-category albums
Post by: angey on September 09, 2014, 11:08:12 pm
It worked, thank you so much!!  :)  ;)
Title: Re: Hiding non-category albums
Post by: Αndré on September 10, 2014, 11:31:54 am
Marking thread accordingly. Next time, please do that yourself as explained in the board rules.
Title: Re: Hiding non-category albums
Post by: sindbad5 on September 12, 2014, 07:51:34 am
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   
Title: Re: Hiding non-category albums
Post by: Αndré on September 12, 2014, 09:05:46 am
Empty albums will be deleted:
Code: [Select]
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":
Code: [Select]
cpg_db_query("UPDATE {$CONFIG['TABLE_ALBUMS']} SET visibility = owner + ".FIRST_USER_CAT." WHERE category = '0'");