Is it possible to simply display a users mycred points in their expert profile?

I have a bbpress forum in which experts earn points by answering questions, is there a way to just show the number of mycred points in the experts profile page? Thanks!

  • Adam Czajczyk
    • Support Gorilla

    Hey Lukas,

    I hope you're well today and thank you for your question!

    I think this can be done via myCred shortcode. You will find a full list of all shortcodes available here:
    http://codex.mycred.me/category/shortcodes/

    The one you'll most likely want to use would be "[mycred_my_balance]"
    http://codex.mycred.me/shortcodes/mycred_my_balance/

    To make use of it, you may want to create a custom "Expert profile" page.

    - create a standard page in WordPress
    - go to "Jobs" -> "Settings" -> "General settings" page
    - scroll down and enable the "Pages Manager" add-on
    - go to "Jobs" -> "Settings" -> "Pages Manager" page
    - select your new page from the dropdown box for "My Profiles" option and save settings.

    - go back to this new page
    - make sure that the basic shortcodes are there, this is the default version of a page:

    <!-- You may edit this page, the title and the slug, but it requires a minimum of the correct page shortcode to function. You can recreate the original default page by deleting this one. -->
    
    <p style="text-align: center">[jbp-job-browse-btn][jbp-expert-browse-btn][jbp-job-post-btn][jbp-expert-post-btn][jbp-my-job-btn][jbp-expert-profile-btn]</p>
    [jbp-expert-archive-page]

    Add the [mycred_my_balance] shortcode there and save.

    Of course if you already have an existing page for experts profile you don't have to create a new one - simply add the shortcode there.

    I hope that helps!

    Cheers,
    Adam

    • Lukas Feddern
      • Site Builder, Child of Zeus

      Ok thanks for you help, sounds great. Just one thing, the "[mycred_my_balance]" shortcode displays the balance of the user viewing the profile but can take a user id as its attribute. Is there a way to automatically find the id of the person who created the profile that is being viewed instead and then pass that into the shortcode? Thanks

  • Predrag Dubajic
    • Support

    Hi Lukas,

    We could try creating custom shortcode based on your first response and use that to get ID of the author.

    Can you try adding this code to your theme functions.php

    // Add Shortcode
    function custom_shortcode() {
    
    	// Code
    	$user_id = get_the_author_meta( 'ID' );
    	echo mycred_get_users_cred( $user_id );
    
    }
    add_shortcode( 'mycred_custom_shortcode', 'custom_shortcode' );

    And then try using this shortcode:
    [mycred_custom_shortcode]
    Let us know if this worked for you.

    Best regards,
    Predrag

  • Nice
    • Design Lord, Child of Thor

    Hi Predrag,

    Just curious about this topic. If I may ask: is the code you provided intended to be used with other modifications or simply a stand-alone addition? Thanks in advance.

    Warm greetings,
    Nice

    • Daisy
      • Flash Drive

      Greetings,

      I have added the shortcode accordingly and I do get the appropriate points of a given user on their profile. My question is how to have the points display under the profile image and above the Likes? Also, how can this be set as a default? As of now, I edit Experts manually, by going into Experts/Manage Experts/ select each Expert individually to enter the shortcode for the points to display. I appreciate your guidance!

      Thank you,

  • Nice
    • Design Lord, Child of Thor

    Thanks a lot Predrag. So in short, all I have to do is add that first piece of code in my functions.php and then insert the shortcode on the expert profile page?

    Edit: I did the above, but I can't see the my_cred points of a user appearing in his/her expert profile. Anything I may be doing wrong?

    Warm regards

  • Daisy
    • Flash Drive

    Greetings,

    I have added the shortcode accordingly and I do get the appropriate points of a given user on their profile. My question is how to have the points display under the profile image and above the Likes? Also, how can this be set as a default? As of now, I edit Experts manually, by going into Experts/Manage Experts/ select each Expert individually to enter the shortcode for the points to display. I appreciate your guidance!

    Thank you,

    • Predrag Dubajic
      • Support

      Hi @Daisy,

      Thanks for posting in this thread, however it might be best if you open your own so we can threat this issues separately.

      It also means the member who started this thread or anyone following it isn't inundated with post notifications each time we respond to each other. A lengthy thread could annoy the original poster.
      This also allows us to better track and answer your questions to ensure we don't miss any for you.

      You can start a new thread here and link this thread for reference:
      https://premium.wpmudev.org/forums/#question

      Best regards,
      Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.