BuddyPress bp_is_my_profile() method not working in custom PHP file
-
I’m working on a custom WordPress site that uses a BuddyBoss child theme that I’ve been heavily modifying over the past few months. Note that I’m using WordPress multisite version 4.1.8, and Buddypress version 2.9.0.
I’m currently working on a custom PHP template that’s using JQuery’s Colorbox plugin to load a PHP file in modal window via ajax. The popup that contains the PHP file is being displayed without any issues .. and the native WordPress functions within it are working as expected. But the one BuddyPress method that I’m trying to use is not working .. namely “bp_is_my_profile()”.
Here is my PHP code:
<?php require("../../../../../../wp-blog-header.php"); require('../../../../../../wp-load.php'); if ( is_user_logged_in() ) { // THIS METHOD IS WORKING if ( bp_is_my_profile() ) { // THIS METHOD IS NOT WORKING echo '<p>This is your Buddypress profile page.</p>'; } else { echo '<p>This is NOT your Buddypress profile page.</p>'; } } else { echo '<p>You are not authorized to access this resource.</p>'; } ?>
What do I need to add to this PHP file in order for the “bp_is_my_profile()” method to work correctly? I’ve already verified that this method DOES in fact work when I call it within a normal PHP template file that’s part of my child theme. I just can’t seem to get it to work when calling it from any other PHP file .. despite the fact that I’m loading both the “wp-blog-header.php” & “wp-load.php” files.
Thanks,
– Yvan
- You must be logged in to reply to this topic.