Score in Activity vs the email

Home Forums Legacy Support Support queries Other issues Score in Activity vs the email

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #322272
    ART-Providers
    Participant
    Hi Using the Hide score option and code provided by Alex, we are able to change the score to display 'Status-Complete' instead of score. This is correctly showing in activity replacing score with the text 'Status-Complete' But the mail with course result still shows score. How can we show the same in email too please? This is correct - https://snipboard.io/NvcOsK.jpg This is still wrong showing score - https://snipboard.io/ik3Dpu.jpg Regards
    #322499
    Anshuman Sahu
    Keymaster
    Well in emails it would not be possible to hide . We need to add some changes in the core code itself to do this as well as foe the activity .
    #322548
    ART-Providers
    Participant
    Hi Alex, Somehow I remember it worked earlier with your previous code I believe. I cannot now replicate the same. My Dev said:

    The mail is being sent from the following function in the file bp-course-notifications.php in the plugin vibe-course-module.

    function student_email_course_evaluation($course_id,$marks,$user_id){ $enable = get_user_meta($user_id,'student_course_evaluation',true); if($enable !== 'no'){ $user = get_user_by( 'id', $user_id); $to = $user->user_email; $subject = sprintf(('Course %s results available','vibe'),$this->get_the_title($course_id)); $message = sprintf(('You\'ve obtained %s in Course : %s','vibe'),apply_filters('wplms_course_marks',$marks.'/100',$course_id),' get_permalink($course_id).'">'.$this->get_the_title($course_id).''); bp_course_wp_mail($to,$subject,$message,array('action'=>'student_course_evaluation','item_id'=>$course_id,'marks'=>$marks,'tokens'=>array('course.name'=>$this->get_the_title($course_id),'course.titlelink'=>'get_permalink($course_id).'">'.$this->get_the_title($course_id).'','course.marks'=>$marks))); }

    }

    Although the message is being filtered correctly , this message is not being used since we have migrated to buddy press emails. The marks get passed directly as 'course.marks'. Isn't there a way to say Status-Complete in mails when marks is 1 ? Regards The code is Wp Customiser which otherwise works is for Activity: add_action('bp_get_course_check_course_complete',function($id){ $meta = get_post_meta($id,'hide_scoring',true);
    if( !empty($meta) && $meta == 'H'){
        echo '<style>.congrats_message{display:none;}</style>';
    
        //adding this to force complete progress by marking score 1
    
    add_filter('wplms_course_student_marks',function($u_marks,$id,$user_id){ // $upload_course = get_post_meta($id,'vibe_course_package',true); // if(!empty($upload_course )){ if(function_exists('bp_course_update_user_progress')){ bp_course_update_user_progress($user_id,$id,100); } return 1; // }
    return $u_marks;
    
    },10,3); } }); //Change note for 1/100 score add_filter('wplms_course_marks',function($marks){ if($marks == '1/100'){ $marks = 'Status - Complete'; //you can write here in quotes what you want to display } return $marks; });
    #322934
    Anshuman Sahu
    Keymaster
    Yes the email will be sent we need time to check if we can actually do this with the current code architecture.
    #324955
    ART-Providers
    Participant
    Hi Have you been able to check how this can be achieved please
    #325100
    Anshuman Sahu
    Keymaster
    Nope we did not get the time since we are engaged to relased the wplms s3 addon compatible with v4 as long promised . Will check please provide some time for this, also please ping back for a reminder .
    #326431
    ART-Providers
    Participant
    Can you please follow up on this matter. Regards
    #326701
    Anshuman Sahu
    Keymaster
    please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :
    add_action('wplms_evaluate_course',function($course_id,$marks,$user_id){
        $package = get_post_meta($course_id,'vibe_course_package',true);
        if(!empty($package)){
            $a = bp_course_activity::init();
            remove_action('wplms_evaluate_course',array($a,'evaluate_course'),10,3); 
            remove_all_actions('wplms_evaluate_course');
        }
        
    },1,3);
    #327104
    ART-Providers
    Participant
    Hi Alex Thank you. You had helped write a code to set Hide Score on Front end and when selected it sets the score to 1. We had a check so if it was 1 to replace it with text - "Status complete' in the activity. The only problem was that the mail still displayed score. I put this add action code which removes all evaluation. Where should we put it so it activates only when Hide Score is 'Yes'.

    Now it's not working correctly anymore and my score shows even if I set to Hide.

    The current code is: add_filter('wplms_course_metabox','custom_fileds'); function custom_fileds($field1){ $prefix = 'vibe_'; $field1[]=array( // Text Input 'label' => ('Hide scoring','wplms-front-end'), // <label> 'desc'=>('hide Scoring','wplms-front-end' ),// description 'id' => 'hide_scoring', // field id and name 'type' => 'switch' ,// type of field, 'options' => array( array('value' => 'H','label' =>('Hide','vibe-customtypes')), array('value' => 'S','label' =>('Show','vibe-customtypes')), ), 'std' => 'H' ); return $field1;
       }
    
    add_filter('wplms_course_creation_tabs','add_in_front_end'); function add_in_front_end($settings){
    $fields = $settings['course_settings']['fields'];
    $arr=array(array(
                'label' =&gt; __('Hide Scoring','wplms-front-end'), // &lt;label&gt;
                'text'=&gt;__('Hide Scoring','wplms-front-end' ),// description
                'id'  =&gt; 'hide_scoring', // field id and name
                'type'  =&gt; 'switch', // type of field
                'options' =&gt; array('S'=&gt;__('NO','wplms-front-end' ),'H'=&gt;__('YES','wplms-front-end' )),
                 'std'   =&gt; 'H'
                ));
    
    array_splice($fields, (count($fields)-1), 0,$arr );
    $settings['course_settings']['fields'] = $fields;  
    
    return $settings; } add_action('bp_get_course_check_course_complete',function($id){ $meta = get_post_meta($id,'hide_scoring',true);
    if( !empty($meta) &amp;&amp; $meta == 'H'){
        echo '&lt;style&gt;.congrats_message{display:none;}&lt;/style&gt;';
    
        //adding this to force complete progress by marking score 1
    
    add_filter('wplms_course_student_marks',function($u_marks,$id,$user_id){ // $upload_course = get_post_meta($id,'vibe_course_package',true); // if(!empty($upload_course )){ if(function_exists('bp_course_update_user_progress')){ bp_course_update_user_progress($user_id,$id,100);
        }
        return 1;
    
    // }
    return $u_marks;
    
    },10,3); } }); //Change note for 1/100 score add_filter('wplms_course_marks',function($marks){ if($marks == 1){ $marks = 'Status - Complete'; //you can write here in quotes what you want to display } return $marks; }); add_action('wplms_evaluate_course',function($course_id,$marks,$user_id){ $package = get_post_meta($course_id,'vibe_course_package',true); if(!empty($package)){ $a = bp_course_activity::init(); remove_action('wplms_evaluate_course',array($a,'evaluate_course'),10,3); remove_all_actions('wplms_evaluate_course'); } },1);
    #327105
    ART-Providers
    Participant
    This reply has been marked as private.
    #327340
    ART-Providers
    Participant
    Could you please help. We want the Courses with 'Hide scoring' enabled to have course completion 100% and certificate or badge option available but with no score. https://snipboard.io/dW2ToC.jpg Where do you want me to insert this new code for this to work appropriately. You had given me the Hide score code for Frontend earlier.
    #327777
    Anshuman Sahu
    Keymaster
    Hi changed are made not activity shown now. https://prnt.sc/vut8p0
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Score in Activity vs the email’ is closed to new replies.