I've updated to 2.1 version on my localhost. It worked like a charm even with buddylist module turned on. So I thought "horray"!!! (see http://drupal.org/node/163873 for details)

Then I uploaded OG_User Roles 2.1 to my live site. The "Configure member roles" tab did not appear to group founders.

But what is absolutely terrible is that when logs out he is taken to a white page which says:

Fatal error: Call to undefined function arg() in /home/hypertop/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 990

And now I cannot log back in into my own live site because it keeps displaying this Fatal Error.

Comments

somebodysysop’s picture

Look at this issue: http://drupal.org/node/138633. Try turning off page caching for now to see what happens.

We dealt with something similar here: http://drupal.org/node/149469. However, before I start modifying code, I'd like to have a better idea of what's going on.

I don't know what module causes this, I only know that this problem is occuring because there is a call to load the user object after logout and for some reason the arg() function is not available at that point.

If turning off the page caching doesn't work, then try adding this code:

    if (!function_exists('arg') && $user->uid > 0) {
      drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); // added as per this issue: http://drupal.org/node/149469
    }

after line 961 (that is, following this line):

function og_user_roles_all_roles($user) {

Let me know if it works.

somebodysysop’s picture

Assigned: Unassigned » somebodysysop

Sorry, just realized you don't have a $user after logout, so try this:

    if (!function_exists('arg')) {
      drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); // added as per this issue: http://drupal.org/node/149469
    }
drupalina’s picture

thanks. I tried the latter line that you gave and also later disabled the Normal (recommended) chaching in Admin>>Performance. These are my results.

After I re-enabled the module and implemented the line that you gave, it became a little bit smoother -- in a sense that one could easily login and logout.

But then there was an error in a warning "red box" after one logged in which said something about inability to load the header. Which I took was OG_user_roles clashing with my chache setting.

My cach setting is set to Normal (recommended) ... because I can see that setting it to Advanced Caching will cause side-effects to a hole bunc of modules including OG_User_Roles. So, I disabled even the average (normal, recommended) caching option. Then these problems seem to had gone away: anyone could login and out with no problems of warning messages.

Now here is the strange thing: later I started experimenting with various combinations of deleting that line and enabling the Normal caching... and everytime I did that the system was behaving unpredictably. Like for instance I deleted both the line and enabled normal cache and if before it would give me trouble, now it behaves normally.

It looks like it is not that line that causes the cure to fatal error on line 990, but the disabling of cache altogether.

I think a module like this makes sense for high traffic websites, where there are many groups large enough to have their own hierarchy of roles. Which is why it doesn't make sense that it should work with Cache being totally disabled.

But even with cache being turned off, the "Configure member roles" tab still does not appear to "Group founders" on my live site (eventhough it appears on my localhost) -- eventhough the settings are almost identical.

PS: now my localhost website is behaving funny: some Group founders can see the "Configure member roles", while other's can't.

somebodysysop’s picture

But even with cache being turned off, the "Configure member roles" tab still does not appear to "Group founders" on my live site (eventhough it appears on my localhost) -- eventhough the settings are almost identical.

PS: now my localhost website is behaving funny: some Group founders can see the "Configure member roles", while other's can't.

There's a definate instability somewhere, but with all the possible modules and configurations on your sites, it's very hard to try and figure. All I know is how OG User Roles works in my environment, and how it should behave when installed in a typical Drupal site.

So, I have to go back to the original issue, which is the fatal error on line 990. This is caused by the function arg() not being recognized. In order to get it recognized, you must load the bootstrap, which is what the lines I gave you do.

If, as you say, page caching is the issue and not the bootstrap, then we have to ask the question: Is it possible to delete just one page in the cache instead of the entire page cache?

Again, I point you to the debug table to see what you can discover there: http://drupal.org/node/164038

somebodysysop’s picture

Status: Active » Needs review
StatusFileSize
new7.35 KB

This patch should fix this particular problem regardless of whether caching is on or off. Please apply to 2.1 release and verify.

If you need info on how to apply patches: http://drupal.org/patch/apply

somebodysysop’s picture

Status: Needs review » Closed (fixed)

Patch code now committed to 2.2 release. Fatal error issue resolved. Buddylist issue resolved here: http://www.drupal.org/node/163873