Bug with permalinks and imagebrowser
-
WordPress up to date? yes 3.5.1
NextGEN up to date? yes 1.9.10MySQL up to date (5.2.4)? doesnt matter
PHP up to date (5.0)? doesnt matter
The mod_rewrite Apache module activated? yes
PHP Safe Mode OFF? yesWho are you hosted with? myself
Does this error still occur if you switch your theme to the WP default, and deactivate all plugins except NextGEN Gallery? yesBehaviour:
If I use the imagebrowser ([imagebrowser id=1]) in one of my pages I can only switch until the fourth picture in the gallery. If I try to switch to the fifth picture the imagebrowser will start from the beginning. There are 32 picture in this gallery.Cause:
I started to check the difference between the fifth and the other pictures. Finaly I realized that the fifth picture has a numeric filename. That caused wordpress to generate a numeric slug for this image (e.g. 123456.jpg -> /mypage/gallery/image/123456).After a bit of search I found the bug in the nggfunctions.php:693
if ( is_numeric($pid) )
The value of $pid is in this case 123456 so the variable is actually numeric and the $act_pid will get the value 123456 instead of the picture index in the $picarray.
Thats why on line 710 the array_search will return false and the fallback later on will jump to the first image of the gallery.
Fix:
Just to check if the variable is numeric is a quiet bit dirty but I’m to lazy to think about a better way. Thats why I added a second condition:
if ( is_numeric($pid) && !$GLOBALS['wp_rewrite']->using_permalinks())
A simple and quick fix for this problem. It works for my case, but I didn’t checked if it works without or with another permalink structure:
/%year%/%monthnum%/%day%/%postname%/
It should be easy for you to fix it in further versions.
Regards,
Simon
- The topic ‘Bug with permalinks and imagebrowser’ is closed to new replies.