Advertisement
Guest User

buddypress check avatar

a guest
May 8th, 2012
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. // in functions.php
  2. <?php
  3. function user_has_avatar() {
  4.   global $bp;
  5.   if ( !bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'no_grav' => true ) ) )
  6.    return false;
  7.    return true;
  8. }
  9. ?>
  10.  
  11.  
  12. // at the bottom of header.php
  13.  
  14. <?php
  15. global $bp;
  16. if( !bp_get_user_has_avatar()) :
  17. ?>
  18.     <div class="alert">
  19.         <button class="close" data-dismiss="alert">×</button>
  20.         <strong>Warning !</strong> My message ....l.
  21.         </div>
  22. <?php
  23. endif;
  24.  
  25. // test two
  26. if( !user_has_avatar() ) :
  27. ?>
  28.     <div class="alert">
  29.         <button class="close" data-dismiss="alert">×</button>
  30.         <strong>Warning !</strong> My message ....l.
  31.         </div>
  32. <?php
  33. endif;
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement