Download & Extend

Calling drupal_add_feed in hook_init breaks theming

Project:Comment RSS
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Calling drupal_add_feed indirectly calls theme_init, which performs the assignment of the $theme variable before switchtheme_init gets a change to update $custom_theme.

Apparently it is a no-no to do anything that initializes theming in hook_init (see here: http://drupal.org/node/219910).

Comments

#1

Title:Calling drupal_add_feed in hook_init breaks SwitchTheme module» Calling drupal_add_feed in hook_init breaks theming
Version:6.x-2.0» 6.x-2.x-dev

#2

Status:active» needs review

This patch replace the hook_init() call with hook_nodeapi() and hook_theme_registry_alter().

This solves the $custom_theme problem and an added benefit is that the Custom RSS links in the header now comes *after* the core RSS links.

AttachmentSize
commentrss_594484.patch.patch 4.04 KB

#3

Status:needs review» reviewed & tested by the community

Just came across this bug with the themes in Organic Groups. Patch worked for me, though it's worth noting for anyone else who tries it that it will fail against 6.x-2.2 and only works against head.

#4

I can second the RTBC here. This issue popped up for me on ThemeKey module #754970: Skipped rule checking because another module already initialized the theme engine and upping to HEAD and applying the patch in #2 fixed the issue.

#5

Status:reviewed & tested by the community» fixed

This has now been fixed with the following commits:
http://drupalcode.org/project/commentrss.git/commit/e25c49a
http://drupalcode.org/project/commentrss.git/commit/739a525

#6

Status:fixed» closed (fixed)

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

nobody click here