Opened 6 years ago
Closed 5 years ago
#8429 closed enhancement (fixed)
Fire a hook when non-BP page is detected
| Reported by: | Gabe462 | Owned by: | imath |
|---|---|---|---|
| Priority: | normal | Milestone: | 10.0.0 |
| Component: | Core | Version: | 7.1.0 |
| Severity: | normal | Keywords: | good-first-bug has-patch commit |
| Cc: |
Description
at /src/bp-core/bp-core-catchuri.php:252
I'd like there to be a do_action( 'bp_not_a_buddypress_page' );
<?php if ( empty( $matches ) ) { do_action( 'bp_not_a_buddypress_page' ); return false; }
This leaves a convenient hook that I'd use for preventing enqueueing of BP assets that aren't used on other parts of the site.
Attachments (1)
Change History (12)
#2
@
6 years ago
I'm a +1 on this too for the convenience. IIRC you can test bp_is_blog_page() to achieve the same effect.
#3
@
6 years ago
- Keywords good-first-bug added
- Milestone Awaiting Review → 8.0.0
Sure! Let's do it!
do_action( 'is_not_buddypress' ) might be a better name ;)
@Gabe462 what about building a patch about it and attach it to this ticket ? We have a nice tutorial about how to do it, if needed: https://codex.buddypress.org/participate-and-contribute/contribute-with-code/
#5
@
6 years ago
I don't think this new hook is necessary. If you want to dequeue assets, hook onto 'wp_enqueue_scripts' as usual and use the is_buddypress() function to determine if the current page is a BuddyPress page, then dequeue anything you do not want loaded.
The proposed hook would still require you to hook onto an action like 'wp_enqueue_scripts' anyway.
#6
@
6 years ago
@r-a-y Whilst I agree with you about there being other methods to dequeue assets (I also posted one above) I can also see that it could be useful to know at the earliest opportunity that it's not a BuddyPress page - and without the possibility that the return values from is_buddyress() or bp_is_blog_page() are being filtered.
#7
@
6 years ago
Here's what I suggest, if @Gabe462 builds the patch and add it to this ticket, we include it! Let's reward new contributors 🤩
#8
@
5 years ago
- Milestone 8.0.0 → Awaiting Contributions
Looks like this ticket is not progressing. As it's not a "must have" fix/feature, let's wait for some contributions about it.
@
5 years ago
Hi, I am also looking for something like this then found this ticket. It would be nice if you decided to add this. I created a patch as you mentioned earlier.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hello @Gabe462! 👋
Something like this seems like a pretty neat idea. I am +1.