Skip to:

Opened 13 years ago

Closed 13 years ago

#3375 closed defect (bug) (fixed)

Deprecated function call in bp-core-template.php

Reported by: amereservant's profile amereservant Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch dev-feedback


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)

3375.01.diff (1.8 KB) - added by boonebgorges 13 years ago.

Download all attachments as: .zip

Change History (8)

#1 @DJPaul
13 years ago

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.

#2 @boonebgorges
13 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 @boonebgorges
13 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 @boonebgorges
13 years ago

  • Keywords has-patch dev-feedback added; needs-patch needs-docs removed
  • Severity changed from major to normal

#5 @DJPaul
13 years ago

We can properly deprecate bp_is_root_component(), too.

#6 @boonebgorges
13 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.

#7 @boonebgorges
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4839]) Refactors bp_is_blog_page() to use simpler logic, and to avoid reference to unused bp->root_components. Fixes #3375

Note: See TracTickets for help on using tickets.