Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

WP phpBB Bridge Plugin Hack: Author Bio Box Avatar

By: sumghai on Nov 24th, 2012  |  syntax: PHP  |  size: 1.22 KB  |  views: 34  |  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. /**
  2.  * Hack: Getting the avatar from phpBB for WordPress internal use, for post author bio
  3.  * Originally written by mbazdell, fixed by R. Chang
  4.  */
  5.  
  6. function get_forum_author_avatar($authemail, $size)
  7. {
  8.         global $user;
  9.  
  10.         $config_php = trim(get_option('wpbb_config_path'));
  11.        
  12.         require($config_php);
  13.                
  14.         $cn = mysql_pconnect($dbhost . ":" . $dbport, $dbuser, $dbpasswd);
  15.         @mysql_set_charset(get_option('wpbb_dbms_charset', 'utf8'), $cn);
  16.  
  17.        
  18.         if($cn)
  19.         {
  20.             if(@mysql_select_db($dbname))
  21.             {
  22.                 $qr = "SELECT u.`user_avatar`, u.`user_avatar_type` FROM `" . $table_prefix  ."users` u WHERE u.`user_email` = '" . $authemail . "'";
  23.                 $rs = @mysql_query($qr, $cn);
  24.             }
  25.  
  26.             while($i = mysql_fetch_assoc($rs))
  27.             {
  28.                 $avatar = '<img
  29.                    alt=""
  30.                    src="' . wpbb_get_avatar($i['user_avatar'], $i['user_avatar_type']) . '"
  31.                    class="avatar avatar-' . $size . ' photo"
  32.                    height="' . $size . '"
  33.                    width="' . $size . '"
  34.                />';
  35.             }
  36.         }
  37.     return $avatar;
  38. }