Skip to:
Content

BuddyPress.org

Opened 15 years ago

Closed 15 years ago

#1346 closed defect (bug) (worksforme)

Function bp_is_profile_component() is catching non-buddypress blog pages as profile components.

Reported by: trusktr's profile trusktr Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 1.2 Priority: major
Severity: Version:
Component: Keywords:
Cc: trusktr

Description

I'm using conditional tags to apply different titles on my pages (not <title> tags, just headings)

However, the bp_is_profile_component() function is catching normal blog pages as profile components so the incorrect statement is executed.

For example, on my blog page at http://bettafootwear.com/CrownYourFeet/store

bp_is_profile_component() is assuming that this page is a profile component. Obviously, it's not and has nothing to do with BuddyPress.

If you visit the site, you'll notice a "»3" where the title should be. I put the number 3 there in order to catch the culprit function. Here's the code I'm using in my template:

			<div class="titlewords"><span>
<?php 
if (is_home()) { echo '» Betta Footwear'; } 
elseif (is_category('footwear')) { echo '» Collection.'; } 
elseif (is_category('meet-your-quotea')) { echo '» Quotes.'; } 
elseif (is_archive()) { echo '» Archives.'; } //this also catches categories not listed above
elseif (is_single()) { echo '» Features.'; } 
elseif (is_404()) { echo '» 404: Not found.'; } 
elseif (is_search()) { echo '» Search results:'; } 
elseif (bp_is_page('register')) { echo '» Create account.'; } 
elseif (bp_is_page('blogs')) { echo '» Blogs.'; } 
elseif (bp_is_blogs_component()) { echo '»1 '; bp_user_fullname(); } 
elseif (bp_is_page('members')) { echo '» Skaters.'; } 
elseif (bp_is_page('forums')) { echo '» Forums.'; } 
elseif (bp_is_page('groups')) { echo '» Groups.'; } 
elseif (bp_is_groups_component()) { echo '»2 '; bp_user_fullname(); } 
elseif (bp_is_page('activate')) { echo '» Activation.'; } 
elseif (bp_is_profile_component()) { echo '»3 '; bp_user_fullname(); } //This is the culprit! ^^
elseif (bp_is_activity_component()) { echo '»4 '; bp_user_fullname(); } 
elseif (bp_is_friends_component()) { echo '»5 '; bp_user_fullname(); } 
else { echo '» final'; } 
?>
			</span></div>

There you can see that "»3" corresponds to the bp_is_profile_component() function

Change History (6)

#1 @trusktr
15 years ago

Please email me if the system doesn't automatically do it! Thanks!

#2 @johnjamesjacoby
15 years ago

  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

The problem is that you have WPMU and BuddyPress running in two sub directories off of the root. At the moment there isn't a fix (even running 1 level deep isn't recommended), but I can give you a possible work-around...

In buddypress/bp-core/bp-core-catchuri.php, line 68 is...

$component_index = 0;

Change that to...

$component_index = 1;

...and return here with the results.

I'm not sure this will be core territory, but you may convince me to add a filter to the index so that non-standard installations can make adjustments without modifying the core.

#3 @johnjamesjacoby
15 years ago

Just looked again, and I was wrong; you're only 1 level deep, but the above fix should still work.

#4 @apeatling
15 years ago

  • Cc trusktr added

trusktr: Please test the fix above and let us know if it works for you.

#5 @apeatling
15 years ago

  • Milestone set to 1.2

#6 @apeatling
15 years ago

  • Resolution set to worksforme
  • Status changed from assigned to closed

I've just tested with trunk and this seems to be fixed. Please confirm otherwise.

Note: See TracTickets for help on using tickets.