You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I solved a cache issue in the previous version of the plugin, but the last update reversed it. So I thought, lets create an issue. If an item has 0 replies, the plugin won't hit the cache, despite the fact that that a cache record is available. This is caused by wrongly testing if a cache record exists.
The fbComments_combineCommentCounts method uses get_option to check if a wordpress option exists. By definition this method returns a null value if the item does not exist. The if-statement should check for this null value, because if the option exists but returns 0 (zero replies yet), it won't hit the cache, and connects with facebook.
fix: check for null
// Return the cached comment count (if it exists)
if (get_option("fbComments_commentCount_$xid") !== null) {
return fbComments_getCachedCommentCount($xid, $value);
}
The text was updated successfully, but these errors were encountered:
This cache problem will continue with this proposed solution.
That's because, according to the wordpress documentation, the return for the get_option is FALSE in case there's no value to the requested option. Quoting the documentation:
Description
"A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned. "
This can be verified in this page: http://codex.wordpress.org/Function_Reference/get_option
In the description for the funciton get_option
So, the correct if statement is slightly different. I tried this one and it went ok:
if (get_option("fbComments_commentCount_$xid") !== FALSE) {
I solved a cache issue in the previous version of the plugin, but the last update reversed it. So I thought, lets create an issue. If an item has 0 replies, the plugin won't hit the cache, despite the fact that that a cache record is available. This is caused by wrongly testing if a cache record exists.
The fbComments_combineCommentCounts method uses get_option to check if a wordpress option exists. By definition this method returns a null value if the item does not exist. The if-statement should check for this null value, because if the option exists but returns 0 (zero replies yet), it won't hit the cache, and connects with facebook.
fix: check for null
The text was updated successfully, but these errors were encountered: