• Resolved Peter

    (@pijag)


    Hi,
    I want to integrate users with my cred badges so I have pasted code from settings (integrations) in my functions.php file but badges not showing properly (icons not appears) – only text.

    https://d.pr/i/7fGVV3

    Any idea how to solve this problem?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support gVectors Support

    (@gvectorssupport)

    Hi @pijag,

    Please remove the code you’ve added in active theme’s functions.php file and add the following one:

    add_filter('wpdiscuz_after_label', 'wpdiscuz_mc_after_label_html', 110, 2);
    function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
        if ($comment->user_id) {
            if (function_exists('mycred_get_users_rank')) { //User Rank
                $afterLabelHtml .= mycred_get_users_rank($comment->user_id, 'logo', 'post-thumbnail', array('class' => 'mycred-rank'));
            }
            if (function_exists('mycred_get_users_badges')) { //User Badges
                $users_badges = mycred_get_users_badges($comment->user_id);
                if (!empty($users_badges)) {
                    foreach ($users_badges as $badge_id => $level) {
    					$badge = mycred_get_badge( $badge_id, $level );
    					if ( $badge === false ) continue;
    
    					$badge->image_width  = 22;
    					$badge->image_height = 22;
    
    					if ( $badge->level_image !== false )
    						$afterLabelHtml .= $badge->get_image( $level );
                    }
                }
            }        
        }
        return $afterLabelHtml;
    }
    Thread Starter Peter

    (@pijag)

    Thank you!
    Now working fine ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Mycred – badges not showing properly’ is closed to new replies.