Opened 12 years ago
Closed 7 years ago
#4767 closed enhancement (maybelater)
Does 1.7 make plugins.php defunct?
Reported by: | modemlooper | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.7 |
Component: | Core | Keywords: | trac-tidy-2018 |
Cc: |
Description
Or is there logic for this that uses plugins.php to filter the_content. Is there a method to override BP's override of the_content?
say you want to have groups/slug <- not a group but a sub page with some loop or content
What will be the method to put content here. bp_core_load_template ?
Change History (9)
#2
@
12 years ago
Note that plugins.php is still used in home.php, the same as it always was. The intention is that plugins that used it before, can still use it now.
#3
@
12 years ago
These questions are mostly independent from each other.
Does 1.7 make plugins.php defunct?
No. plugins.php works the same way as it does now for new components as well as group extensions. BP's theme compat layer loads plugins.php dynamically in the same way as every other BP template, and it can be overridden in a theme in the normal way.
Is there a method to override BP's override of the_content?
If you mean "can I change the template that BP chooses to use for a given content type", then you should filter 'bp_get_template_part'
.
say you want to have groups/slug <- not a group but a sub page with some loop or content
This doesn't really have anything to do with theme compatibility. When you make a request for example.com/groups/foo/
, BP assumes you're looking for a group called foo
. If there's no group by that slug, BP will return a 404. If you want to override that 404, you'll have to either hook in before BP runs its routing magic, or (as John suggests above) after BP fails (in which case you'll have to unset the 404 in addition to whatever custom routing you want to do).
What will be the method to put content here. bp_core_load_template ?
I'd suggest using bp_get_template_part()
, because that'll allow others (like themers) to take advantage of BP's template stack logic.
#4
@
12 years ago
thanks guys, for the info. I was asking specifically to have a way to have a fallback template for /groups/non-group-slug
Let say we have /teams/ and you want to have /teams/sign-up with some sign up info. There isn't a easy way to allow this. I've managed to get a sub url working but the javascript goes haywire if you click a tab and you are not on the group root. if you are on a sub url and click a tab you load the entire website. http://dev.taptappress.com/groups/name-of-tab/ I blocked js on that tab just to get an idea of what happens. Click the all groups and you can see what happens.
I was thinking we could add a plugins.php for directories. So that tabs can hook into and utilize the javascript to load content.
#5
@
12 years ago
I was thinking we could add a plugins.php for directories
Ah. That's a reasonable request, but it's out of scope for 1.7. In the meantime, you may want to look at how BP detects whether it's looking at a core directory (such as groups_directory_groups_setup()
for the groups directory) and mimic that kind of logic in your own template loader.
#6
@
12 years ago
I'll put it on my backburner for 1.8. Loading the content is easy, it's the directory tab javascript that needs more logic to load a plugins.php file.
#8
@
7 years ago
- Keywords trac-tidy-2018 added
We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.
Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.
If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.
For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/
A good question. Remember that plugins.php uses 'bp_template_content', not 'the_content.'
When the_content gets called, BuddyPress's theme compat filter should not be hooked in, or at least fail. Consider also that plugin.php is a specific template that should only get included when no other BuddyPress core template is requested, which is to say that some other plugin manually requested it.
The method is not unlike what it was before, and similar to the template loader.