Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting Buddypress avatars the right way?


  • Xevo
    Participant

    @xevo

    Hi BuddyPress devs,

    I’m trying to get the BuddyPress avatars outside of BuddyPress, but since they’re not inside the database, what is the correct/best way to get them outside of the folders? I thought of just using substr and see if I can find bpthumb or bpfull, but maybe someone else here has a better solution?

    Just so you guys know, this is to get the buddypress avatars in a bbpress install.

    Thanks,

    Mitchell

Viewing 2 replies - 1 through 2 (of 2 total)

  • Xevo
    Participant

    @xevo

    Bump, working with readdir and substr now and just looking for the avatar files.

    Anyone have a better solution?


    Xevo
    Participant

    @xevo

    function xe_loggedin_user_avatar($type = "", $width = "", $height = "") {
    global $bb_current_user;
    $userID = $bb_current_user->ID;
    $files = "";
    if ($handle = opendir('/var/www/vhosts/tsukai.nl/httpdocs/wp-content/uploads/avatars/' . $userID)) {
    while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
    if($type == "thumb") {
    if(substr($file, -11, 7) == "bpthumb" ) {
    $files .= $file;
    }
    } elseif($type == "full") {
    if(substr($file, -10, 6) == "bpfull" ) {
    $files .= $file;
    }
    }
    }
    }
    closedir($handle);
    }

    echo '<img src="http://tsukai.nl/wp-content/uploads/avatars/' . $userID . '/' . $files . '" width="' . width . '" height="' . $height . '" />';
    }

    This is the solution I came up with, again, if anyone has a better solution, do tell.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Buddypress avatars the right way?’ is closed to new replies.
Skip to toolbar