Opened 15 years ago
Closed 15 years ago
#2093 closed defect (bug) (no action required)
bp_is_page() returns wrong result, crippling user profile navigation functionality
Reported by: | foxly | Owned by: | |
---|---|---|---|
Milestone: | 1.2.3 | Priority: | major |
Severity: | Version: | ||
Component: | Keywords: | bp_is_page, header not displaying, BP_XPROFILE_SLUG | |
Cc: |
Description
When a user is on a member's profile page, the call "bp_is_page(BP_XPROFILE_SLUG") incorrectly returns FALSE if it is run in the header.php file.
This defect also affects BP_ACTIVITY_SLUG, BP_BLOGS_SLUG, BP_FORUMS_SLUG, BP_FRIENDS_SLUG, BP_GROUPS_SLUG, and any pages that take the form www.example.com/members/membername/SLUG. It does not affect pages of the form www.example.com/SLUG/.
To replicate:
On a default installation of buddypress using the default buddypress template, add the following code at line 45 in header.php
<?php if (bp_is_page(BP_XPROFILE_SLUG))echo 'PROFILE TRIPPED';?>
<?php if (bp_is_page(BP_FORUMS_SLUG))echo 'FORUMS TRIPPED';?>
When you visit the forums page, "FORUMS TRIPPED" will be displayed in the header, but when you visit a user profile page, PROFILE TRIPPED will not be displayed.
...
This defect causes a major problem for anyone trying to build buddy press navigation menus, because it makes it impossible to identify many of the site's pages. It also indicates some kind of underlying defect in how the $bp global variable is getting updated.
Change History (5)
#3
@
15 years ago
You should be using conditional template tags as DJPaul mentioned. Most are valid in 1.2.1. You can view a list of the latest here:
http://trac.buddypress.org/browser/branches/1.2/bp-core/bp-core-templatetags.php#L1376
Use bp_is_user_profile(). There is a codex page on these but they haven't been updated for 1.2; they are defined in bp-core-templatetags.php (line 1378).