Wordbook - Incompatible with other Facebook plugins (2 posts)

  1. Wordbook is incompatible with virtually every other Facebook related plugin for WordPress. This is critical functionality, and I've basically had to stop using Wordbook because of the lack of it. I hope that this sort of fix can be implemented, soon.

    The problem is very simple: The plugin loads the Facebook API every single time, whether it needs it or not.

    Right at the top of the plug-in you have this code:

    if (substr(phpversion(), 0, 2) == '5.') {
    define(FACEBOOK_PHP_API, 'PHP5');
    } else {
    define(FACEBOOK_PHP_API, 'PHP4');

    That loads the Facebook APIs into place. Fine.

    When I'm looking at my main blog page, the Facebook APIs don't have to load to do that. When I'm looking at other pages in my admin page, the Facebook APIs don't have to load to do that.

    In fact, the only time I need the Facebook APIs loaded is:
    a) When saving/editing the options for the plugin.
    b) When submitting an actual post to the blog.

    That's it. So why are they loading on every single pageview? Not only is it a waste of time and a major slowdown, but it's causing the incompatibilities!

    Wrap that little bit of code in a function called "load_wordbook_apis" and then just call that function when the apis are about to be used in the plugin itself. Voila, problem solved.

    I would post this on his comments section, but I'm not going to register to somebody's blog just to leave them a comment, so I'm posting this here and on the Facebook Application discussion board in the hopes that the author will see this and fix the problem.

    Also, other plugin authors should take note of this too. Keep your plugins low impact. If you don't need to load an API, don't load it. Try not to have plugins do anything until they're actually used and thus have to do something. This sort of thing makes the plugins fast and efficient.

    In fact, there's something to be said for keeping the main functionality in a separate file anyway. The main plugin file should only contain the basic interface for the plugin. Then, when it's used, it can require_once() the main files and call the right stuff to do the work. These files then only actually get parsed when they are used, making little to no impact on the site when they are not used.

  2. This has been fixed in Wordbook version 0.11.11, available here:

Topic Closed

This topic has been closed to new replies.

About this Topic