Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Hiding non-category albums  (Read 3922 times)

0 Members and 1 Guest are viewing this topic.

angey

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Hiding non-category albums
« 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!  :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #1 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?
Logged

angey

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Hiding non-category albums
« Reply #2 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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #3 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.
Logged

angey

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Hiding non-category albums
« Reply #4 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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #5 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 ;)
Logged

angey

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Hiding non-category albums
« Reply #6 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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #7 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.
Logged

angey

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Hiding non-category albums
« Reply #8 on: September 09, 2014, 11:08:12 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #9 on: September 10, 2014, 11:31:54 am »

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

sindbad5

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: de
  • Offline Offline
  • Posts: 215
    • My Images - medienarchiv.com
Re: Hiding non-category albums
« Reply #10 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   
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Hiding non-category albums
« Reply #11 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'");
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.