
buddypress check avatar
By: a guest on
May 8th, 2012 | syntax:
PHP | size: 0.67 KB | hits: 31 | expires: Never
// in functions.php
<?php
function user_has_avatar() {
global $bp;
if ( !bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true ) ) )
return false;
return true;
}
?>
// at the bottom of header.php
<?php
global $bp;
if( !bp_get_user_has_avatar()) :
?>
<div class="alert">
<button class="close" data-dismiss="alert">×</button>
<strong>Warning !</strong> My message ....l.
</div>
<?php
endif;
// test two
if( !user_has_avatar() ) :
?>
<div class="alert">
<button class="close" data-dismiss="alert">×</button>
<strong>Warning !</strong> My message ....l.
</div>
<?php
endif;
?>