FAlbum suddenly not displaying albums?
February 15th, 2008 | Design & Development |Up to this week I've had no trouble with FAlbum (ver 0.7.1). It's a very useful Wordpress plugin for quickly integrating your Flickr gallery into your site.
I have been using it drive a client's photo gallery for the last 3 months when this week it decides to stop working. It still showed Recent photos without any trouble, and it could also show a list of photosets, but If i tried to go to any page of photosets/albums or try to view photos in a photoset/album it would just display a blank gallery.
I looked at the code all morning. I cleared FAlbum's cache and watched it generate a new page. First it would call the flickr api to try to figure out which photoset to display, then it would return the correct photoset_id and sanitized photoset/album title. After this it should have been able to display the photos correctly. For some reason however, a second call for the same information would go through, this time it would hit the FAlbum cache and it did not return the correct photoset_id, instead it returned a sanitized version of the photoset/album title. It was infuriating trying to find why FAlbum made the second call to the cache even though it had the correct information from the first time round. And why oh why was the cache not giving back the correct information.
I decided that the implementation of the cache was rubbish and rewired the cache methods in falbum/wp/FAlbum_WP.class.php to use the WP Object Cache instead. Problem solved.
If anyone is having the same problem, here are the two methods rewritten to use the Wordpress Object Cache. Remember to make sure that the cache is enabled in wp-config.php with this line define('ENABLE_CACHE', true);.
-
function _get_cached_data($key, $cache_option = FALBUM_CACHE_EXPIRE_SHORT) {
-
if(!$data){
-
$this->logger->debug("MISS wp-cache: $key");
-
$data = null;
-
}
-
else{
-
$this->logger->debug("HIT wp-cache: $key\n result: $data");
-
}
-
return $data;
-
}
-
-
/* Function to store the data in the wp-cache */
-
function _set_cached_data($key, $data, $cache_option = FALBUM_CACHE_EXPIRE_SHORT) {
-
$this->logger->debug('added to wp-cache: '.$key);
-
}
-
else{
-
$this->logger->debug('set wp-cache: '.$key);
-
}
-
}
I haven't decided how to go about implementing _clear_cached_data() yet as wp_cache_flush doesn't appear to support flushing a specific flag e.g. wp_cache_flush('falbum'). If anyone has any suggestions please comment below.








March 4th, 2008 at 6:11 pm
thanks for your code & help.
I have the same problem with you.
Thx a lot~
April 3rd, 2008 at 5:41 pm
thanks for the info !! i would like to know what filename should i edit and use the code above?
April 3rd, 2008 at 6:38 pm
@erict
As mentioned above, edit FAlbum_WP.class.php in the wp folder of the falbum plugin.
May 10th, 2008 at 7:29 am
[...] I finally dug up this fantastic article on exactly how to work around this issue. Thank you JohnnyPez.com. If you’re having the same issue: 1. Disable the falbum plugin 2. Ensure wp-config.php [...]
August 16th, 2008 at 3:05 am
Thank you so very much!!! This has stumped me for about 6 months now and I just had to pull the photos from my site. Thanks again.
August 29th, 2008 at 2:17 pm
[...] site. Sorry for the delay. I had to do some hacking of the falbum plugin. Special thanks goes to johnnypez.com (and Google!) for helping me with the [...]