Skip to:

Opened 6 months ago

Last modified 3 weeks ago

#5208 new defect (bug)

enqueues buddypress.js

Reported by: bassjobsen Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 1.8.1
Component: Core Keywords:


in bp-templates/buddypress-legacy/buddypress-functions.php the function enqueue_scripts() enqueues buddypress.js. buddypress.js not only depends on jquery but also on jquery-cookie.
Set the $deps Array of the handles in the wp_enqueue_script() call to array('jquery','jquery-cookie') will fix this.

Thanks for your attention. I will need this fixes to get WP Defer Loading work with BuddyPress, see:

Change History (7)

comment:1 boonebgorges6 months ago

We don't enqueue based on jquery.cookie because the plugin is shipped inline in buddypress.js. So it's not technically a dependency, at least not in the sense that wp_enqueue_script() understands dependencies.

Can you explain the sorts of problems that are being caused by the current setup?

comment:2 bassjobsen6 months ago


Thanks for your response. I have to say, sorry cause i made a mistake my fix seems not to load buddypress.js at all (which fix my error, but broke other things).

I still got a problem with buddypress.js and it's inline cookie and other plugins.

Cause i load the script deferred the document ready already fired (or better happened).
So the document ready functions are fired after reading. The plugins are at the end of the source and not read (exist) when the functions run.

So maybe this not a bug but a request.
You will help my plugin function when moving the plugin to the start of the source. Something like:

{{{/* jQuery Easing Plugin, v1.3 - */
/* jQuery Cookie plugin */
/* ScrollTo plugin - just inline and minified */
;(function($){var h=$.scrollTo=function(a,b,c)...
/* jQuery querystring plugin */

var jq = jQuery;

Global variable to prevent multiple AJAX requests
var bp_ajax_request = null;
AJAX Functions
jq(document).ready( function() {

/ Page Load Actions */}}}

comment:3 boonebgorges6 months ago

I guess my preference, rather than doing that, would be to put the plugins into separate files and then enqueue them properly. Do any other devs have opinions about this?

comment:4 DJPaul6 months ago

I don't think we want to do this for 1.9. Perhaps 2.0, or whenever the updated theme templates are ready.

comment:5 bassjobsen6 months ago

@boonebgorges i also think enqueue them properly will be the best solution.
@DJPaul what about move the plugin to the begin / start of the source?

comment:6 boonebgorges6 months ago

  • Milestone changed from Awaiting Review to 2.0

Let's do a proper fix for 2.0. We will not necessarily be able to cut the inline plugins out of our plugins altogether - that'd break child themes, etc that enqueue our assets directly from the BP folder, and won't change the dependencies - but we can do some sort of conditional thing.

comment:7 boonebgorges3 weeks ago

  • Milestone changed from 2.0 to 2.1
Note: See TracTickets for help on using tickets.