This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

buddypress check avatar

By: a guest on May 8th, 2012  |  syntax: PHP  |  size: 0.67 KB  |  views: 63  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>
clone this paste RAW Paste Data