Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3399 closed enhancement (fixed)

Audit usage of bp_is_current_component()

Reported by: r-a-y's profile r-a-y Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch commit
Cc:

Description

Attached patch swaps out bp_is_current_component( $component ) with wrapper bp_is_X_component() functions already created in bp-core-template.php.

Attachments (2)

3399.01.patch (22.6 KB) - added by r-a-y 13 years ago.
3399.02.patch (12.5 KB) - added by r-a-y 13 years ago.

Download all attachments as: .zip

Change History (14)

@r-a-y
13 years ago

#1 @DJPaul
13 years ago

  • Type changed from defect to enhancement

#2 @johnjamesjacoby
13 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 1.5
  • Version 1.5 deleted

Looks good.

#3 @boonebgorges
13 years ago

r-a-y, can I ask you to repatch this? It won't apply cleanly because of the whitespace cleanup.

@r-a-y
13 years ago

#4 @r-a-y
13 years ago

Repatched!

I noticed some other overlap like:
!bp_is_current_component( 'activity' ) || !bp_is_user()

Which is the same as:
!bp_is_user_activity()

So I added them in this patch. There could be more like this in the codebase.

#5 @cnorris23
13 years ago

Replacing
!bp_is_current_component( 'activity' ) || !bp_is_user()

with
!bp_is_user_activity()

won't work, as bp_is_user_activity() is only a wrapper function for bp_is_current_component( 'activity' ).

#6 @r-a-y
13 years ago

I added in the bp_is_user() check for bp_is_user_activity() in the patch, so we should be good!

#7 @cnorris23
13 years ago

Awesome! Good call on my part (hangs his head in shame) :)

#8 @johnjamesjacoby
13 years ago

Missing bp_is_members_component()

#9 @johnjamesjacoby
13 years ago

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

(In [5072]) Audit _is_ functions and _current_component_ functions. Props r-a-y. Fixes #3399.

#10 @johnjamesjacoby
13 years ago

Note I switched the order of a few things not in this exact patch, putting bp_is_user() ahead of the component checks, etc...

When doing multiple checks in succession, always put the check with the least amount of processing first.

Otherwise, thanks as always for the great patch.

#11 @r-a-y
13 years ago

Gothca about order in multiple checks!

Caught some typos in r5072. On lines 1180 and 1195, the function names are missing ending parentheses.

Note: See TracTickets for help on using tickets.