Hooking ajax actions inside of function scope in BP 1.6 causes issues with some themes
|Reported by:||boonebgorges||Owned by:|
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).