BP global worksheet

<?php
function bp_dump() {
global $bp;

foreach ( (array)$bp as $key => $value ) {
echo '<pre>';
echo '<strong>' . $key . ': </strong><br />';
print_r( $value );
echo '</pre>';
}
die;
}
add_action( 'wp', 'bp_dump' );
?>

<?php //Main Worksheet ~~~~~~~~~~~~~~~~~
//Call the global
global $bp;

// Displays the current component, like activity, members etc.
echo 'Current Component = ' . $bp->current_component;

// Displays the current action within the members window, like friends, mentions, anything in the ajax window.
echo 'Current Action = ' . $bp->current_action;

// Displays the current users profile URL.
echo 'Profile URL = ' . $bp->displayed_user->domain;
?>

3 Comments

You must be logged in to post a comment.


  1. No problem, these snippets are here for everyone to experiment with. Feel free to register and store yours here too, it's easy to see all of your own just by clicking on your author name.


  2. [...] copied from: http://code.hyperspatial.com This entry was posted in buddypress, wordpress. Bookmark the permalink. Post a comment or leave a [...]


  3. Hi,
    I have copieda few of your snippets to my own snippet collection, as I used some of these.
    I hope you don't mind, and I added the source explicitly on mine...

    thanks, forthis smallcollection

    Simon