Testing to see if current page is profile page
-
I’m using the code below to insert a menu link to user’s profile if they are logged in and to give it a “selected” class. It works, but the link is chosen as selected even when it is not on the members profile page, it is “selected” on every page…
Anyone have any ideas on what I would I add to test “if current page is profile page” to THEN add the “selected” class?
Thanks!!!
<?php if ( is_user_logged_in() ) {
if ( strpos($_SERVER['REQUEST_URI'], "/members/{$current_user->user_login}/") !== false ) { ?>
<li ><?php bp_loggedinuser_link () ?></li>
<?php } else { ?>
<li class="selected"><?php bp_loggedinuser_link () ?></li>
<?php }
} ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Testing to see if current page is profile page’ is closed to new replies.