WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Bug Report for nggShowAlbum() (4 posts)

  1. Darren Ethier (nerrad)
    Member
    Posted 3 years ago #

    I'm pretty sure I've caught a bug here that needs fixing (simple fix).

    in nggfunctions.php (around LINES 370-371) for the function nggShowAlbum():

    if ( is_array($album->gallery_ids) )
            $out = nggCreateAlbum( $album->gallery_ids, $template, $album );

    will sometimes return $out as null because of some inconsistency in ngg-db.php (around LINES 330-332) for the function nggdb::find_album():

    // Unserialize the galleries inside the album
            if ( $album ) {
                if ( !empty( $album->sortorder ) )
                    $album->gallery_ids = unserialize( $album->sortorder );

    The database field for gallery ids is actually "galleries". What happens is that in certain cases $album->galleries will be returned from nggdb::find_album() rather than the expected $album->gallery_ids in nggShowAlbum().

    A simple fix would be to change $album->gallery_ids TO $album->galleries in nggdb::find_album(); This would have to be propagated in two other locations: in the nggShowAlbum() function (as seen above) and around LINE 635 in ngg-db.php:
    Change:
    $gallery_list = implode(',', $album->gallery_ids);
    To:
    $gallery_list = implode(',', $album->galleries);

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. Alex Rabe
    Member
    Posted 3 years ago #

    What happens is that in certain cases $album->galleries will be returned from nggdb::find_album()

    How can I reproduce this case ? Which way do you call find_album() ?

  3. Darren Ethier (nerrad)
    Member
    Posted 3 years ago #

    I've created an add-on plugin that enables my client to use a custom shortcode for adding a specially formatted page for listing a jcarousel of all the galleries in multiple albums (a carousel for each album).

    Here's a portion of the code that calls nggdb::find_album()

    foreach ( $albuminfo as $album ) {
    	$album_url = get_permalink($album->pageid);
    	$album_galleries = nggdb::find_album( $album->id );
    	$gallery_ids = $album_galleries->galleries;
            //...rest of code goes here

    $albuminfo was gained from nggdb::find_all_album() earlier in the code. I know that there is $album_galleries->galleries in my code. That's because if I used $album_galleries->gallery_ids it didn't work.

  4. Alex Rabe
    Member
    Posted 3 years ago #

    Ohh, I see in nggdb::find_all_album() I used "galleries" and in nggdb::find_album() I used "gallery_ids". Yes this is inconsistence, not a bug but really inconsistence. I will look into it

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.