• Resolved Dirk Claesen

    (@dirk-claesen)


    Is there a possibility to also hide albums that only contain subalbums but that do not contain any photos? (The album and all of the subalbums of the album do not contain any photo.)

    I know option II-E6 will hide the albums that do not contain photos. But when an album without photos contains one or more empty subalbums it will nevertheless be displayed.

    Kind regards,
    Dirk Claesen

    https://www.ads-software.com/plugins/wp-photo-album-plus/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    This is a good question. I will change it in the next version.

    You can test my proposed patch as follows:

    in wppa-functions.php line 890 it reads:

    // Check for empty albums
    	if ( wppa_switch('wppa_skip_empty_albums') ) {
    		$user = wppa_get_user();
    		if ( is_array($albums) ) foreach (array_keys($albums) as $albumkey) {
    			$albumid 	= $albums[$albumkey]['id'];
    			$albumowner = $albums[$albumkey]['owner'];
    			$photocount = wppa_get_photo_count($albumid);
    			$albumcount = wppa_get_album_count($albumid);
    			if ( ! $photocount && ! $albumcount && ! current_user_can('administrator') && $user != $albumowner ) unset($albums[$albumkey]);
    		}
    	}

    change to:

    // Check for empty albums
    	if ( wppa_switch('wppa_skip_empty_albums') ) {
    		$user = wppa_get_user();
    		if ( is_array($albums) ) foreach (array_keys($albums) as $albumkey) {
    			$albumid 	= $albums[$albumkey]['id'];
    			$albumowner = $albums[$albumkey]['owner'];
    			$treecount 	= wppa_treecount_a($albums[$albumkey]['id']);
    			$photocount = $treecount['photos'];		// wppa_get_photo_count($albumid);
    //			$albumcount = wppa_get_album_count($albumid);
    			if ( ! $photocount /* && ! $albumcount */ && ! current_user_can('administrator') && $user != $albumowner ) unset($albums[$albumkey]);
    		}
    	}

    Thread Starter Dirk Claesen

    (@dirk-claesen)

    Thanks for the quick fix. Empty albums are now correctly hidden.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide albums with subalbums but without photos’ is closed to new replies.