Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

#7512 closed defect (bug) (no action required)

JS Enqueued On Non-BuddyPress Admin Pages

Reported by: kstover's profile kstover Owned by: r-a-y's profile r-a-y
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords:
Cc:

Description

Hi,

I'm the lead developer of Ninja Forms, and we recently discovered a plugin conflict with BuddyPress.

Our form builder uses a jQuery plugin called "caret," which is also used by BuddyPress. Unfortunately, BuddyPress is enqueuing its version on our admin pages.

This is the offending file:

/bp-core/js/vendor/jquery.caret.min.js

My guess is that it should only be enqueued on BuddyPress-related admin pages.

Thanks.

Change History (9)

#1 @hnla
8 years ago

  • Keywords dev-feedback added

#2 @r-a-y
8 years ago

  • Keywords reporter-feedback added

Hi @kstover,

Thanks for the report, however I think we do use the caret JS though for at-mentions in the post editor. I guess we could enqueue this only on the edit.php and post-new.php admin pages.

How does that sound?

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.


8 years ago

#4 @kstover
8 years ago

  • Keywords reporter-feedback removed

That sounds fine; the big problem is that it appears to be loading on all admin pages, not just those it's used on. BuddyPress doesn't have anything to interact with in our builder.

#5 @r-a-y
8 years ago

  • Component changed from Core to Administration
  • Keywords needs-patch added; dev-feedback removed
  • Milestone changed from Awaiting Review to 2.9
  • Owner set to r-a-y
  • Status changed from new to assigned
  • Version set to 2.1

Thanks for the quick reply.

Expect a fix for v2.9. In the meantime, you'll have to hack around this by deregistering BP's caret.js in your plugin.

#6 @kstover
8 years ago

Thanks very much! Hacking already in progress. :)

#7 @r-a-y
8 years ago

  • Keywords reporter-feedback added

Hi @kstover,

I looked into the code today and it looks like caret.js is enqueued correctly.

caret.js is only enqueued on admin pages if it meets the following conditions:

  • If it is on a post or page admin page
  • If the current post type supports the editor

https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-activity/bp-activity-cssjs.php#L23

Can you tell me on what pages that caret.js leaks where it shouldn't?

#8 @kstover
8 years ago

I don't think the problem is necessarily enqueuing. It looks like BP registers the caret script with the same slug we do, and that registration happens across the admin. So, any scripts that register or try to enqueue cart after that point get the BP version. I think the simplest solution for us is to prefix our caret registration.

#9 @r-a-y
8 years ago

  • Keywords needs-patch reporter-feedback removed
  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

Yeah, I think prefixing your caret name is probably best.

Thanks for talking this through, @kstover.

Going to close this one.

Note: See TracTickets for help on using tickets.