Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_core_fetch_avatar() is not getting latest uploaded avatar


  • Kchun
    Participant

    @kchun

    At line 163 in file bp-core-avatars.php we need to add checking of the file time in order to be sure we are getting the most recent uploaded avatar:

    Add after:
    `
    // Check for array
    if ( 0 < count( $avatar_files ) ) {
    `
    These 2 lines:
    `
    $avatar_file_time=0;
    $avatar_home_path=str_replace($bp->root_domain,ABSPATH,$avatar_folder_url);
    `
    Modify the foreach loop that follows like this:

    // Check for current avatar
    foreach( $avatar_files as $key => $value ) {
    if ( strpos ( $value, $avatar_size )!== false ) {
    if($avatar_file_time< ($t=filemtime($avatar_home_path . '/' . $value))) { //NEW
    $avatar_file_time=$t; // THIS IS NEW
    $avatar_url = $avatar_folder_url . ‘/’ . $avatar_files[$key];
    }
    }
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘bp_core_fetch_avatar() is not getting latest uploaded avatar’ is closed to new replies.
Skip to toolbar