Skip to:

Opened 11 years ago

Closed 10 years ago

#5208 closed defect (bug) (fixed)

enqueues buddypress.js

Reported by: bassjobsen's profile bassjobsen Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 1.8.1
Component: Core Keywords:
Cc: valuser@…


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:

Attachments (1)

create-minified-scripts.patch (6.3 KB) - added by dcavins 10 years ago.

Download all attachments as: .zip

Change History (16)

#1 @boonebgorges
11 years 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?

#2 @bassjobsen
11 years 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 */}}}

#3 @boonebgorges
11 years 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?

#4 @DJPaul
11 years ago

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

#5 @bassjobsen
11 years 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?

#6 @boonebgorges
11 years 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.

#7 @boonebgorges
10 years ago

  • Milestone changed from 2.0 to 2.1

#8 @johnjamesjacoby
10 years ago

In 8453:

First pass at unbundling inline jQuery plugins from BP Legacy's buddypress.js and BP Default's global.js. See #5208.

#9 @johnjamesjacoby
10 years ago

r8453 accidentally included the buddypress.pot file. Drat.

Also, it somewhat throws back-compat out the window with replacing the obfuscated and slow jQuery Query plugin, that I honestly could not actually find in the wild anywhere on the internet anymore.

One approach to fixing this would be to write a jQuery.query.get plugin equivalent, but I guess I'm willing to gamble that anyone that copied our old global.js did so completely, will have the inline plugins too, and won't have any problems with the new JS approach.

Needs testing, but I was looking at this code for the past few days and was itchy to get it in early.

#10 follow-up: @johnjamesjacoby
10 years ago

Related: #1673.

#11 in reply to: ↑ 10 @dcavins
10 years ago

Replying to johnjamesjacoby:

Related: #1673.

After updating my test installation fro the GitHub repo, I was getting errors because the minified js files hadn't yet been included.

The script loading is working for me now, though.

#12 @valuser
10 years ago

  • Cc valuser@… added

Was following the track on local installs.
Had a problem with this revision - with a slider plugin (premium - Slider Pro).
Basically the plugin stopped working at this revision with just it and buddypress and theme TwentyTwelve/Twenty Fourteen Theme installed.
Not competent to even suggest anything.
Sent the attachment on this comment to the plugin developer & hopefully he will take it up from there.


#13 @valuser
10 years ago

Have added those 5 javascript files (per dcavins patch above) to bp-core/js ---- no joy

#14 @valuser
10 years ago

Once again I must admit to and apologise for a false alarm.
Please disregard my previous contributions (comments 12,13) on this ticket.

#15 @DJPaul
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Discounting the previous few tickets, I think this is done now, so I'm closing the ticket.

Note: See TracTickets for help on using tickets.