Mlix / nextgen-gallery

Automatically exported from code.google.com/p/nextgen-gallery
0 stars 0 forks source link

SEO handling failure when using numerical album titles/slugs #478

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Alex,
i've got some problems when using NGG with enabled SEO and numerical album 
titles, nggShowAlbum just returns "[Album not found]".
the usage of the is_numeric function into ngg-db.php, function: find_album($id) 
causes the issue.

Im using the following album/gallery structure:
ALL
-2012
--a
--b
--c
--...
-2011
--...
-2010
--...
-2009
--...
-...

Versions:
WordPress 3.3.1, NGG 1.9.3

HOTFIX:
by adding the following code into the 

ngg-db.php file, 
function: "find_album()", 
line 340 (after the $id check)

the problem got fixed. currently i have no great idea to easily modifiy the SEO 
algorithms to prevent such problems. i think the following hotfix could be 
helpful for other users!

// HOTFIX - SEO based URL failure when using numerical slugs for albums
// get options
$pluginOptions = get_option('ngg_options');

// empty album and SEO enabled ? try to find album by slug
if (!$album && $pluginOptions['usePermalinks'] ){
    $album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->nggalbum WHERE slug = %s", $id) );
}
// !HOTFIX - SEO based URL failure when using numerical slugs for albums

best regards, Andi

Original issue reported on code.google.com by andi.dit...@googlemail.com on 1 Mar 2012 at 8:42

GoogleCodeExporter commented 9 years ago
This also goes for Galleries too.
Both find_gallery and get_gallery need to be modified.

Original comment by xell...@gmail.com on 14 May 2012 at 2:59