Okay
  Public Ticket #3494153
add user points to profile
Closed

Comments

  •  12
    MeesterGijs started the conversation

    Hi Alex,

    Now that I can use gamification and reward points for course elements being completed, I would love for the total amount of points to be shown in profile page. Is that possible?

    Gijs

  • [deleted] replied

    already shown here : 

    1432701686.png

    sorry currently there is no shortcode to show points on the public profile.we have to add one.

  •  12
    MeesterGijs replied

    I know. But can I add it to the profile page. Get everything on one page. More logical right?

  • [deleted] replied

    agreed we will try to add it in future updates , track  :https://trello.com/c/wM3cEpk0

  •  12
    MeesterGijs replied

    That's great. That's batches, final scores and quizzes made I would suggest. Just really everything. Or make it as Elementor blocks, so I can choose.

  • [deleted] replied

    Im sorry did not understand do you want in user profile a batch score block as well? how do we calculate the batch score ? score in all courses of the batch/?

  •  12
    MeesterGijs replied

    I mean that a user goes to its profile page, sees all profile date, but also sees his own course scores, his own quizzes made and a list of his own certificates and badges. Like you now have on seperate pages.

  • [deleted] replied

    well there is public profile and private profile (bp single app page) which loads for the student . 

    .all these info can be seen in much details on the app page by the student . 

    for public profile I agree you would like to display student's badges and points earned for which we will be adding shortcodes .

    you can show user's badges on public profile : 

    using this shortcode [gamification_badges]


    but we have yet to add shortcode to show points.

  •  12
    MeesterGijs replied

    How does the shortcode work? I see this when I add it to a text block:

    8750975443.png


  • [deleted] replied

    Im sorry the shortcode is  : 


    [mygamification_badges]

  •  12
    MeesterGijs replied

    Also didn't work. How come? How do I add the code?

    And, is there a list of all the different code?

    5616212019.png


  • [deleted] replied

    working for me : 

    3909811427.png


  •  12
    MeesterGijs replied

    Yes, working for me as well. But now it just shows an image. Nothing to click, no explenations. Can we add the title as well? I mean these descriptions: https://imgur.com/a/5ydwkB9

    You had this random text added which you didn't delete. Visuable for everyone to see. Please be careful!

    "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo."

  • [deleted] replied

    I didn't added any text in your site .

    yes I agree there should be atleast badge title there to show . adding to issue log

  •  12
    MeesterGijs replied

    Thank you

  •   MeesterGijs replied privately
  • [deleted] replied

    Im sorry no extra text can be added here  :https://meestergijs.nl/app/#component=course&action=points_badges

    Please try adding this custom css in your wp-admin-> appearance-> customize -> custom css : 

    .gamification_badges_wrapper .lmsbadge_image {
        color:#ffffff;
        width:64px;
    }

    .gamification_badges_wrapper {
        align-items:center;
        justify-content:center;
        width: 100%;
        display: flex;
    }


  •  12
    MeesterGijs replied

    A pity.

    But code worked.

    Can you also tell me if and how I can add url here?]

    4212231311.png


  • [deleted] replied

    yes that is correctly added .itsn't it showing on the profile?


  •  12
    MeesterGijs replied

    No, there is no link there...

  • [deleted] replied

    Please try adding this custom css in your wp-admin-> appearance-> customize -> custom css : 

    .vibebp_myprofile .user_profile{
        pointer-events:all;
    }


  •  12
    MeesterGijs replied

    Worked!

  •  12
    MeesterGijs replied

    Hi Alex,

    Can we change the code for this shortcode that you created for me; [mygamification_badges]?

    Because now this shortcode shows all gamifaction levels, I just want the most recent/highest score one?

    See profile page: 

    1913716788.png

  • [deleted] replied

    Im sorry there is no such shortcode present as of now and that shortcode was already available in wplms , i did not craete it.,

  •  12
    MeesterGijs replied

    Is there a way to change it, so that users only see the most recent achieved one?

  • [deleted] replied

    yes it shows the recent one first by default .


  •  12
    MeesterGijs replied

    Incorrect. As you can see in my image, just one scroll down this page:

    1913716788.png

  • [deleted] replied


    it does not follows the order in which badges are shown in the gamification menu item it shows the recent badge obtained by the user  first by default .

  •  12
    MeesterGijs replied

    I want it to show ony the most recent one. SO just one, not more than one. Not necessary. If you achieve a new level with any gamification, you only see that new leverl. not all the levels that you have accomplished. Think about it...

    Please help me fix this.

  • [deleted] replied

    add this code in your wplms-customizer.php file in wplms customizer plugin : 

    add_shortcode('newmygamification_badges','gamification_badges');
    function gamification_badges($atts,$content=null){
            
            if(!empty($atts['user_id'])){
                $user_id = $atts['user_id'];
            }else{
                if(class_exists('VibeBP_Init')){
                    $init = VibeBP_Init::init();
                    if(!empty($init->user_id)){
                        $user_id = $init->user_id;
                    }else if(!empty(bp_displayed_user_id())){
                        $user_id = bp_displayed_user_id();
                    }else{
                        return;
                    }
                }else{
                    return;
                }
            }
            $badge_ids = array();
            if(function_exists('bp_activity_get')){
                $badge_ids = bp_activity_get(array(
                    'filter' => array(
                        'action' => 'gamification_badge',
                        'user_id' => $user_id,
                    )
                ));
            }
            if(!empty($badge_ids) && is_array($badge_ids) && is_array($badge_ids['activities'])){
                $r ='<div class="gamification_badges_wrapper">';
                $badge=  $badge_ids['activities'][0];
               
                    $badge_id = $badge->item_id;
                    $image =  get_the_post_thumbnail($badge_id);
                    $r .= '<a href="'. get_the_permalink($badge_id).'" class="tip" title="'.get_the_title($badge_id).'">
                        <div class="lmsbadge_image">
                        '. $image.'
                        '.get_the_title($badge_id).'
                        </div>
                    </a>';
            
                $r .= '</div><style>.gamification_badges_wrapper { display: grid; grid-gap: 1rem; grid-template-columns: repeat(auto-fill,minmax(32px,64px)); position: relative; } .gamification_badges_wrapper img { border-radius: 5px; }</style>';
                return $r;
            }
            return;
        }
    
  •  12
    MeesterGijs replied

    Thanks, but it didn't work. I added the code, but still see all accomplished levels, not just the latest/newest rewarded...

    4786987639.png
    5098385426.png


  • [deleted] replied

    sorry I fixed the code below please copy it again and use this shortcode instead : 

    [newmygamification_badges]

  •  12
    MeesterGijs replied

    Oh, yes! How I love this. Thank you so much. That code worked and it is a valuable addition to the profile page. Thanks!

    ~closing~