Support » Plugin: myCred - Points, Rewards, Gamification, Ranks, Badges & Loyalty Plugin » Can't get %rank% template tag to work.

  • Resolved Joshua Turner-Bruce

    (@joshua-turner-bruce)


    Hello Gabriel,

    First I gotta say the plugin is awesome so far. I just can’t for the life of me seem to be able to display the rank titles using the %rank% template tag. I want to display the title’s of my ranks using one of the widgets and if possible I would like to be able to show the rank title under the user thumbnail in each post and in their profiles.

    No matter what I do I can only get the rank order #1, #2 etc and their credit balance.

    http://wordpress.org/plugins/mycred/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Joshua Turner-Bruce

    (@joshua-turner-bruce)

    I now seem to have messed up my ranking system as well. I was making the points lower for the admin account as it was ridiculously high. No matter how many point I have now though I am always the lowest rank.

    Another note about my issue. I have tried everything with only bbPress and myCRED plugins active with the same results. I am also using the Twenty Twelve theme.

    Site at: joshuaturnerbruce.co.uk/erp

    Plugin Author myCred

    (@designbymerovingi)

    Hi Joshua.

    By default, myCRED will allow you to insert your users rank (post title) and / or rank logo (featured image) in the “myCRED Balance” widget, BuddyPress Profile header or with your users profile details.

    You can add the ranks in other places as well but you would have to hook in yourself and insert the rank yourself.

    Examples:

    Insert rank in the leaderboard:

    add_filter( 'mycred_ranking_row', 'my_custom_ranking_rows', 10, 4 );
    function my_custom_ranking_rows( $layout, $template, $row, $position )
    {
    	$rank_name = mycred_get_users_rank( $user_id );
    	return str_replace( '%rank%', $rank_name, $content );
    }

    Insert rank in bbPress replies:

    add_action( 'bbp_theme_after_reply_author_details', 'add_rank_in_author_details' );
    function add_rank_in_author_details()
    {
    	$reply_id = bbp_get_reply_id();
    	if ( bbp_is_reply_anonymous( $reply_id ) ) return;
    	$user_id = bbp_get_reply_author_id( $reply_id );
    	if ( mycred_exclude_user( $user_id ) ) return;
    	echo 'Rank: ' . mycred_get_users_rank( $user_id );
    }

    If you can tell me where exactly you are trying to show the rank I can offer further assistance.

    Regards your second issue.
    First thing I would do is to make sure while viewing all your ranks on the myCRED Ranks page in your admin area, and make sure that the min. and max. values do not overlap with other ranks.

    A common mistake is users having one rank that is for points ranging from 0 – 99999 then have a second rank with the range 100 – 999.

    If you feel you have “messed” everything up, you can always delete all ranks (delete, not just trash) and start over. As soon as there are no ranks, myCRED will add a default one. You can then start by editing this, as it has a high max value and change it to something that suits you better.

    Thread Starter Joshua Turner-Bruce

    (@joshua-turner-bruce)

    Ahh brilliant thanks for responding. I have the MyBalance widget working and the Rank in replies. When I add the filter for the Leaderboard the board just disappears. I have noticed that if I put %rank% in leaderboard and save the widget it gets changes to %ranking%.

    Lastly how will I add the user rank to their Profile?

    Plugin Author myCred

    (@designbymerovingi)

    Ups. I see an error in the leaderboard example. This should be:

    add_filter( 'mycred_ranking_row', 'my_custom_ranking_rows', 10, 4 );
    function my_custom_ranking_rows( $layout, $template, $user, $position )
    {
    	$rank_name = mycred_get_users_rank( $user['ID'] );
    	return str_replace( '%rank%', $rank_name, $layout );
    }
    Plugin Author myCred

    (@designbymerovingi)

    Regarding the widget with the %rank% template tag in your widget, this should only happen if the ranking add-on is not enabled. Can you confirm that this does not happen when it is?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can't get %rank% template tag to work.’ is closed to new replies.