Theming in drupalforfirebug_user breaking custom Admin theme

sadotter - November 20, 2008 - 20:47
Project:Drupal For Firebug
Version:5.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

The function drupalforfirebug_user() makes a call to theme(), which is breaking the custom Admin theme functionality.

Some background: The custom theme gets set in the function system_menu(). Specifically, drupal fetches the 'admin_theme' variable, and assigns it to the global variable $custom_theme. Ideally, this is supposed to happen before any actual theming occurs, to ensure that the proper theme is set and used.

The problem: a module may invoke hook_user() before system_menu() is fired. In this specific case, it's leading to init_theme() being called before $custom_theme has had a chance to be set.

For example, during invocation of hook_init(), Organic Groups calls user_load(), which invokes hook_user(), which fires drupalforfirebug_user(), which calls theme(), which leads to init_theme() being called. Since the $custom_theme variable hasn't been set yet, drupal decides to use the default theme.

For reference, I've attached the relevant function stack below.

I'm not sure if there's a reasonable fix for this without totally disabling the "Users" tab functionality. Maybe only call the theming function if isset($theme) returns true?

Array
(
    [0] => Array
        (
            [file] => includes\theme.inc
            [line] => 34
            [function] => backtrace
        )

    [1] => Array
        (
            [file] => includes\theme.inc
            [line] => 189
            [function] => init_theme
        )

    [2] => Array
        (
            [file] => includes\theme.inc
            [line] => 168
            [function] => theme_get_function
        )

    [3] => Array
        (
            [file] => sites\all\modules\drupalforfirebug\drupalforfirebug.module
            [line] => 68
            [function] => theme
        )

    [4] => Array
        (
            [file] => modules\user\user.module
            [line] => 22
            [function] => drupalforfirebug_user
        )

    [5] => Array
        (
            [file] => modules\user\user.module
            [line] => 84
            [function] => user_module_invoke
        )

    [6] => Array
        (
            [file] => sites\all\modules\og\og.module
            [line] => 151
            [function] => user_load
        )

    [7] => Array
        (
            [function] => og_init
        )

    [8] => Array
        (
            [file] => includes\module.inc
            [line] => 406
            [function] => call_user_func_array
        )

    [9] => Array
        (
            [file] => includes\common.inc
            [line] => 1870
            [function] => module_invoke_all

        )

    [10] => Array
        (
            [file] => includes\bootstrap.inc
            [line] => 922
            [function] => _drupal_bootstrap_full
        )

    [11] => Array
        (
            [file] => includes\bootstrap.inc
            [line] => 862
            [function] => _drupal_bootstrap
        )

    [12] => Array
        (
            [file] => index.php
            [line] => 13
            [function] => drupal_bootstrap
        )
)

#1

populist - July 2, 2009 - 02:06
Status:active» fixed

I removed the theme calls in the Drupal 5 version which should resolve things.

#2

System Message - July 16, 2009 - 02:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.