Replies
Hello,Brajesh. The problem is I use a shordcode to display the leaderboard. And that code doesn’t seem to get it done. If I don’t use the shortcode I can get it done with that code but I have to create a table, put things in the table according to the documentation in mycred website.
To be more specific, I can you send you the theme I use or I can send you a link to the leaderboard of my website.
Thanks you.
For the number2, actually mycred leaderboard comes with the theme and I use a shortcode provided from the theme to display the leaderboard. The uploaded profile picture here at the leaderboard is width 50 and height 50 by default. I’ve changed the style to
.gfy-bp-component img.avatar { width: 160px; }
But It’s not blurred like the number 1 issue. Just only the gravatar is blurred.It’s now 50 by default.
Previously, I’m done with this code
/** * Add Avatars To Leaderboard * @since 1.0 * @version 1.0 */ 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( $user_id, 90 ); return str_replace( '%avatar%', $avatar, $layout ); }
But this time the leaderboard comes with the theme. I don’t know where to change. The above doesn’t work. The plugin associated with mycred and this theme comes with the theme, it’s gambifly. I’ve check the template file in the plugin, it looks like this
<?php // Prevent direct script access. if ( ! defined( 'ABSPATH' ) ) { die( 'No direct script access allowed' ); } /** * @var $component_classes string Component HTML classes * @var $component_id string Component unique id * @var $shortcode_config array<string,mixed> Shortcode attributes * @version 1.0 */ $local_config = array( 'wrap' => 'tr', 'template' => "<td class='user-position'>%position%</td> <td class='user-avatar'>%user_avatar%</td> <td class='user-name'>%user_profile_link%</td> <td class='user-rank'>%user_rank_logo%</td> <td class='user-points'>%cred_f%</td>" ); $shortcode_config = array_merge( $shortcode_config, $local_config ); ?> <div class="<?php echo $component_classes; ?>"> <div class="table-responsive"> <table class="table table-condensed mycred-table gfy-table"> <thead> <tr> <th class='user-position'>#</th> <th class='user-avatar'><?php _e( 'Avatar', 'gamify' ); ?></th> <th class='user-name'><?php _e( 'Username', 'gamify' ); ?></th> <th class='user-rank'><?php _e( 'Rank', 'gamify' ); ?></th> <th class='user-points'><?php _e( 'Points', 'gamify' ); ?></th> </tr> </thead> <tbody> <?php $output = gfy_do_shortcode( 'mycred_leaderboard', $shortcode_config ); echo GFY_BP_Leaderboard_Component_Template::get_instance()->get_total() ? $output : sprintf( '<tr><td colspan="5">%s</td></tr>', $output ); ?> </tbody> </table> </div> </div>
By the way, Brajesh. I also apply this one to change the default size of mysteryman, the gravatar.
define ( 'BP_AVATAR_DEFAULT', 'https://mysite.com/wp-content/uploads/2018/02/9add5c7d20fee64cb5840e37c93538e6.jpg' ); define ( 'BP_AVATAR_DEFAULT_THUMB', 'https://mysite.com/wp-content/uploads/2018/02/9add5c7d20fee64cb5840e37c93538e6.jpg' );
But it applies to the member directory page but doesn’t apply to myCred leaderboard. Do you know how to change this one too. myCred leaderboard displays top ten users by rank, avatar, points.
If I add this one, does this apply to the one in the profile as well? Because I want to apply to the member directory page only.
define ( ‘BP_AVATAR_THUMB_WIDTH’, 80 );
define ( ‘BP_AVATAR_THUMB_HEIGHT’, 80 );
define ( ‘BP_AVATAR_FULL_WIDTH’, 250 );
define ( ‘BP_AVATAR_FULL_HEIGHT’, 250 );