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

    (@gvectors-team)

    Ok, we found the issue, please remove the current integration code you use and put this code in current active theme’s fnctions.php file:

    ////////////////////////////////////////////////////////////////////////
    // MyCred User Ranks and Badges Integration ////////////////////////////
    ////////////////////////////////////////////////////////////////////////
    add_filter('wpdiscuz_after_label', 'wpdiscuz_mc_after_label_html', 110, 2);
    function wpdiscuz_mc_after_label_html($afterLabelHtml, $comment) {
        if ($comment->user_id) {
            // keep your preffered profile plugin and remove others...
            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) {
                        $imageKey = ( $level > 0 ) ? 'level_image' . $level : 'main_image';
                        $afterLabelHtml .= '<img src="' . get_post_meta($badge_id, $imageKey, true) . '" width="22" height="22" class="mycred-badge earned" alt="' . get_the_title($badge_id) . '" title="' . get_the_title($badge_id) . '" />';
                    }
                }
            }
            if (class_exists('userpro_api')) { // userpro user badges
                $afterLabelHtml .= userpro_show_badges($comment->user_id, $inline = true);
            }
        }
        return $afterLabelHtml;
    }

    Can you add that function as a selectable option in the wpDiscuz Settings?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘MyCred Badges Only Showing First Level’ is closed to new replies.