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 | Owned by: | 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)
This ticket was mentioned in Slack in #buddypress by hnla. View the logs.
8 years ago
#4
@
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
@
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.
#7
@
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
@
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.
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
andpost-new.php
admin pages.How does that sound?