myCred Leaderboard Avatars

Theme support is offered to verified customers by forum only. Support requests and solutions made by email, Skype, Envato or any other method will be redirected back to the forum.

This topic is: not resolved
  • In Progress
    Posted in: Arcane  

  • Member
    WillemV
    February 18, 2019 at 3:32 pm #118308

    Hi Guys

    Im using myCred for a leaderboard for points collected using the site.

    The leaderboard has a column to display the avatars of users and their points, Ranked.

    I have a custom plugin with this below //Plugin Code//

    However, when the leaderboard displays the Avatar of the users it shows the Default Avatar for all users, instead of each users actual current Avatar.

    The myCred support team accessed my Admin Area and try to fix this, but their final response was: “It seems like your theme is conflicting with the code.”

    Now how do I change the code below to show the User actual Avatar instead of the default Avatar?

    //Plugin Code//

    add_filter( ‘mycred_ranking_row’, ‘mycredpro_add_avatars_to_leaderboard’, 10, 4 );
    function mycredpro_add_avatars_to_leaderboard( $layout, $template, $user, $position ) {

    if ( isset( $user->ID ) )
    $user_id = $user->ID;

    elseif ( isset( $user[‘ID’] ) )
    $user_id = $user[‘ID’];

    else return $layout;

    $avatar = get_avatar( $row[‘ID’], 32 );

    return str_replace( ‘%avatar%’, $avatar, $layout );

    }

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.