Opened 14 years ago
Closed 14 years ago
#3375 closed defect (bug) (fixed)
Deprecated function call in bp-core-template.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch dev-feedback |
Cc: |
Description
In the function bp_is_blog_page(), it makes a call to the function bp_is_root_component() and the property $bp->current_component, both of which are considered deprecated.
Attachments (1)
Change History (8)
#2
@
14 years ago
- Milestone changed from Awaiting Review to 1.3
I'm the one who put the 'deprecated' idea into amereservant's head. bp_is_blog_page() is used in several places, but bp_is_root_component(), and the entire idea of $bp->root_components, is not. So, as you suggest DJPaul, bp_is_blog_page() should be reworked.
The logical approach is to compare page ids against bp-pages, and return true if the page id doesn't appear in that list. The big problem with this approach, from what I can see, has to do with plugins that have top level nav items. Ideally, they should be registering themselves in bp-pages, but I do not believe that we have a natural way of doing that at the moment. Yet we still need a way for them to declare that they want their directory pages displayed as BP directories, not as WP content, which is the purpose of bp_is_blog_page().
#3
@
14 years ago
Thought about this a bit more, and realized that checking for bp_current_component() is probably enough. Whenever a page is devoted to BP content, this value will be set. Whenever a page is not devoted to BP content (regular WP pages, blog posts, archives, etc), bp_current_component() will be empty. This will also cover the case of plugins, which presumably will be setting current_component() somehow. See 3375.01.diff. Can someone do a sanity check for me on this?
#4
@
14 years ago
- Keywords has-patch dev-feedback added; needs-patch needs-docs removed
- Severity changed from major to normal
#6
@
14 years ago
bp_is_root_component() is still used in a few places within BP, and the function has been rewritten to do something akin to the old version, but compatible with our new setup. So I don't believe we can deprecate it. In an ideal world, we would clean this up more thoroughly, but given that it's working, I don't want to mess with it.
Neither bp_is_blog_page() nor bp_is_root_component() are marked as deprecated on current trunk, though there are probably better ways of writing these functions now.