Home › Forums › Legacy Support › Support queries › Other issues › Score in Activity vs the email
- This topic has 11 replies, 2 voices, and was last updated 3 years, 4 months ago by Anshuman Sahu.
Viewing 12 posts - 1 through 12 (of 12 total)
-
AuthorPosts
-
November 1, 2020 at 4:31 pm #322272ART-ProvidersParticipantHi 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 RegardsNovember 2, 2020 at 3:33 pm #322499Anshuman SahuKeymasterWell 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 .November 2, 2020 at 9:30 pm #322548ART-ProvidersParticipantHi 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);
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; // }if( !empty($meta) && $meta == 'H'){ echo '<style>.congrats_message{display:none;}</style>'; //adding this to force complete progress by marking score 1
},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; });return $u_marks;
November 4, 2020 at 1:43 pm #322934Anshuman SahuKeymasterYes the email will be sent we need time to check if we can actually do this with the current code architecture.November 17, 2020 at 1:23 am #324955ART-ProvidersParticipantHi Have you been able to check how this can be achieved pleaseNovember 17, 2020 at 3:36 pm #325100Anshuman SahuKeymasterNope 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 .November 25, 2020 at 12:40 pm #326431ART-ProvidersParticipantCan you please follow up on this matter. RegardsNovember 26, 2020 at 4:50 pm #326701Anshuman SahuKeymasterplease 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);
November 28, 2020 at 9:45 pm #327104ART-ProvidersParticipantHi 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){}
return $settings; } add_action('bp_get_course_check_course_complete',function($id){ $meta = get_post_meta($id,'hide_scoring',true);$fields = $settings['course_settings']['fields']; $arr=array(array( 'label' => __('Hide Scoring','wplms-front-end'), // <label> 'text'=>__('Hide Scoring','wplms-front-end' ),// description 'id' => 'hide_scoring', // field id and name 'type' => 'switch', // type of field 'options' => array('S'=>__('NO','wplms-front-end' ),'H'=>__('YES','wplms-front-end' )), 'std' => 'H' )); array_splice($fields, (count($fields)-1), 0,$arr ); $settings['course_settings']['fields'] = $fields;
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);if( !empty($meta) && $meta == 'H'){ echo '<style>.congrats_message{display:none;}</style>'; //adding this to force complete progress by marking score 1
// }} return 1;
},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);return $u_marks;
November 28, 2020 at 9:46 pm #327105ART-ProvidersParticipantThis reply has been marked as private.November 30, 2020 at 10:56 pm #327340ART-ProvidersParticipantCould 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.December 3, 2020 at 6:56 am #327777Anshuman SahuKeymasterHi changed are made not activity shown now. https://prnt.sc/vut8p0 -
AuthorPosts
Viewing 12 posts - 1 through 12 (of 12 total)
- The topic ‘Score in Activity vs the email’ is closed to new replies.