How to get buddypress Avatar in WordPress

So with the same canvas setup in the last post:

<?php
require( '/home/your/absolute/path/wp-load.php' );
$current_user = wp_get_current_user();
$cID = $current_user->ID;

echo bp_core_fetch_avatar ( array( 'item_id' => $cID, 'type' => 'full' ) ) ;

?>

 

How to use Wordpess built-in Functions externally (in posts, widgets etc.)

For our canvas lets use the Enhanced Text Widget plugin, it will let us type Javascript, Flash and even Php directly into the text box..

After you install put this widget box on your sidebar or wherever you insert the following at the top of your code.

require( '/home/my/absolute/path/wp-load.php' );

Here is a simple example which would output something along the lines of : “Hello World Mr facade”.

IMPORTANT: Remember to change the absolute path to the one for YOUR server.

<?php
require( '/home/my/absolute/path/wp-load.php' );
echo "hello world Mr ";
$current_user = wp_get_current_user();
echo $current_user->display_name;
?>

References:

WordPress Codex (get current user) : http://codex.wordpress.org/Function_Reference/wp_get_current_user