[buddypress-trac] [BuddyPress] #4449: Hooking ajax actions inside of function scope in BP 1.6 causes issues with some themes

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sat Aug 18 02:25:22 UTC 2012


#4449: Hooking ajax actions inside of function scope in BP 1.6 causes issues with
some themes
--------------------------+-------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  1.6.2
Component:  Theme         |    Version:  1.6
 Severity:  normal        |   Keywords:  2nd-opinion
--------------------------+-------------------------
 In BP 1.6, hooks for AJAX actions were moved into the function
 `bp_dtheme_register_actions()`, which is hooked to after_setup_theme with
 a priority of 20. Prior to BP 1.6, these add_action() calls were in the
 global scope, meaning that they were fired immediately after the file was
 included. Some themes that directly include BP core's ajax.php, however,
 do it at a point *later* than after_setup_theme (such as
 http://wordpress.org/extend/themes/elbee-elgee, which loads ajax.php at
 widgets_init). As a result, the AJAX handlers are never successfully
 hooked, and AJAX events don't work.

 I'm guessing this is affecting a very small number of themes (most either
 supply their own ajax.php, or load it at after_setup_theme like BP does).
 So it's probably something that we can fix with better documentation. A
 post on bpdevel would probably suffice. I thought I would first open this
 bug ticket, though, to see if any other dev thinks there's a better
 solution (such as moving the hooking event into the global scope - ugly,
 but it would work).

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4449>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list