I am having a trouble developing a module. In my hook_init() function, I call both the function drupal_get_path, and theme_add_style. Whenever I am logged into the admin user account, everything works fine, but when I am anonymous, it comes up with a fatal error because it can't find either function. In drupal 4.6, I can call require_once("includes/common.inc"), but in 4.7, theme_add_style is not found still.

Is there any way to get around having to include common.inc and other files? Is this expected behavior?

I don't like how when viewing as an administrator, it doesn't throw an error, but for anyone else, it does throw an error. I think it could even be considered a bug.

Comments

bradlis7’s picture

Status: Active » Closed (fixed)

I used hook_menu() and !$may_cache. Closing.