[buddypress-trac] [BuddyPress] #2599: bp_core_add_ajax_url_js() generating wrong ajaxurl value

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sun Nov 6 22:14:40 UTC 2011


#2599: bp_core_add_ajax_url_js() generating wrong ajaxurl value
-----------------------------------------+------------------
 Reporter:  Kawauso                      |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  1.6
Component:  Core                         |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  needs-testing needs-refresh  |
-----------------------------------------+------------------

Comment (by r-a-y):

 kawauso's patch looks good for the most part, but backwards compatibility
 is an issue.  Also needs a refresh.

 ---

 Replying to [comment:11 boonebgorges]:
 > +1 for something like this patch, though we'll need to ensure backward
 compatibility with existing plugins. As long as they're using ajaxurl in
 their ajax calls, it should just work, right?

 Not necessarily.  Most plugins using the BP ajax hook do not use the
 `wp_ajax_nopriv` hook. `nopriv` is necessary for frontend AJAX functions
 for non-logged-in users.  So depending on the AJAX use case, it could
 break some existing plugins.

 ---

 Paul makes a great point here:
 http://buddypress.trac.wordpress.org/ticket/2599#comment:2

 If we use admin-ajax.php, it loads all WP admin functions, which is
 unnecessary bloat.

 The major con for not implementing admin-ajax.php is the DOING_AJAX
 constant never works for BP ajax calls.  I've had to implement my own
 conditional to find out if AJAX is firing.

 I might suggest option (4), create our own version of admin-ajax.php.  It
 would be a super-lightweight version of admin-ajax.php, but bypassing all
 the requires and WP post code that admin-ajax.php currently has.  This
 might be considered too extreme though.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/2599#comment:13>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list