I've got what may very well be a "poorly written" issue. My module appears to break OG in 6.x.

When my module is enabled, OG throws this error on group context nodes:

PHP Fatal error: Call to undefined function: node_load() in /modules/og/og.module on line 393, referer: http://mysite.com/og

If this rings any kind of bell, please share as I'm completely lost. Will do my best to improve my code.

Comments

SomebodySysop’s picture

The issue appears to be in hook_boot. Or, rather, my understanding of how it is implemented.

In 5.x hook_init, I had:

    // Bootstrap if arg() doesn't exist
    if (!function_exists('arg') && $user->uid > 0) {
      drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); // added as per this issue: http://drupal.org/node/149469
    }
    // Modification as per: http://drupal.org/node/183860
    og_user_roles_theme(); // This ends up calling og_set_theme();

This is what we call in og_user_roles_theme():

...
  elseif (arg(0) == 'node' && is_numeric(arg(1))) {
    $group_node = og_set_theme(arg(1));
...

And, it worked.

When I changed hook_init to hook_boot in 6.x, the same code fails with the "undefined function" error. Apparently, the bootstrap doesn't work for the og_set_theme() call. Hmmm...

Well, I can at least get past the problem by commenting out the line that calls og_user_roles_theme(). But, I'd like to figure out how to set the theme at this point -- and not generate a node_load failure in another module.

Thanks for any assistance.

SomebodySysop’s picture

Status: Active » Fixed

Looks like what I needed, in some format or other was something like this:

    // Modification as per: http://drupal.org/node/183860
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);  // http://drupal.org/node/273068
    og_user_roles_theme();

This port to 6.x is going to be a lot of fun!

moshe weitzman’s picture

Project: Organic groups » OG User Roles
Version: master » 5.x-3.2
Component: og.module » Code
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.