• WP-OpenID, at least in my site, uses 2 megabytes of memory. That is probably reasonable.

    It also needs the browser to load four javascript files to work: jquery.js, jquery.textnode.js, jquery.xpath.js and openid.js That is probably reasonable, too.

    What is unreasonable is that it uses 2 megabytes of memory AND browsers have to load four javascript files on every single blog page.

    WP-OpenID is loading all its authentication machinery when my visitor is reading my archives. WP-OpenID is loading all its admin-screens machinery when my visitor runs a search in my blog. Meanwhile, the four javascript files are adding several seconds to page load times.

    I tried to reclaim memory by coating the core.php file with the conditional

    if (is_single() || is_admin() || stripos($_SERVER['PHP_SELF'],'wp-login.php') > 0) {
        // all of core.php
    }

    However this quick hack doesn’t work. Would you please tell me what if condition to use?

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pinoyca

    (@pinoyca)

    Can anyone help me with this? Why are is_single() and is_admin() giving the wrong result?

    if you are comfortable with using subversion, I’d recommend taking a look at my latest blog post about wp-openid. I believe a lot of the changes I made cleaned up the loading code. If it looks like it is still loading unnecessarily, please file a bug in the DiSo issue tracker if it’s not already there.

    Thread Starter pinoyca

    (@pinoyca)

    I read your post, and thanks for the info that wp-openid reinvents wp-comments-post.php but is terrible at it. I appreciate all your work on this plugin.

    Can you answer my question though? Why are is_single() and is_admin() giving the wrong result? I just want to quickly exclude the plugin on pages that don’t need it.

    plugins get loaded very early on in the process. At the time of loading the plugin, wordpress doesn’t know if the page is single or not. The correct solution here would be to have the hook methods be very lightweight and only load up the openid object if necessary. I’m all about better performance, so I’ll see what I can do in that regard.

    Thread Starter pinoyca

    (@pinoyca)

    You’re right. I glanced at some plugins I used to use, and their authors basically used this structure:

    class MonstrousClass {
      require_once('MonstrousLibraryOfFunctionsMyPluginsUse.php');
      require_once('SecondMonstrousLibraryOfUsefulGadgets.php');
      require_once('AnotherMonstrousClass.php');
      $data = new HugeClassOfSorts();
      function doohickey() {
        /* do something with $data */
      }
      add_action('inconsequential_hook','doohickey');
      /* ... */
    }
    $plugmein = new MonstrousClass();

    These authors don’t realize that few of us run our own servers. I hope they don’t see themselves proud they use object-oriented PHP and “encapsulation.”

    Nowadays when I shop for plugins I sort them by filesize first.

    Best Regards,

    Thread Starter pinoyca

    (@pinoyca)

    Bump.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WP-OpenID] How do I make it load only when needed?’ is closed to new replies.