Home › Forums › Legacy Support › Support queries › Other issues › Assignment Answer Customization Reimplementation
Tagged: answers, assignment, custom
- This topic has 4 replies, 2 voices, and was last updated 9 years, 2 months ago by mesrick.
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
October 8, 2015 at 9:08 pm #2087mesrickSpectatorHi, I had a you guys do a customization such that assignments would be displayed to students only after they submit that assignment. (see more details here: http://support.vibethemes.com/support/tickets/432) I had a database corruption and did a fresh install, etc. I need to reimplement that customization. Please advise.October 10, 2015 at 2:07 pm #2354Anshuman SahuKeymasterHere is the code please add it to your wplms-customizer.php : add_filter('wplms_assignments_metabox','custom_explantion'); function custom_explantion($wplms_assignments_metabox){ $wplms_assignments_metabox[]=array( // Single checkbox 'label' => __('Explanation','vibe-customtypes'), // <label> 'desc' => __('Assignment explanation','vibe-customtypes'), // description 'id' => $prefix.'explanation', // field id and name 'type' => 'editor', // type of field 'std' => '' ); return $wplms_assignments_metabox; } add_action('wplms_assignment_after_content','show_explanation'); function show_explanation(){ global $post; if(is_user_logged_in()){ $user_id=get_current_user_id(); $user_time = get_user_meta($user_id,$post->ID,true); $assignment_time = get_post_meta($post->ID,'vibe_assignment_duration',true); $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter',86400); $expiry = $user_time+$assignment_time* $assignment_duration_parameter; $assignment_finished = get_post_meta($post->ID,$user_id,true); if(isset($assignment_finished) && is_numeric($assignment_finished) && $expiry < time()){ $explanation= get_post_meta( $post->ID,'explanation',true); if(isset($explanation) && !empty($explanation)) echo apply_filters('the_content',$explanation); } } }October 12, 2015 at 6:41 pm #2570mesrickSpectatorWhenever I add this code, if breaks my site. Should I be adding this to a child theme or main theme?October 14, 2015 at 12:11 pm #2925Anshuman SahuKeymasterAdd the code in wplms-customizer.php file in wplms customizer plugin and it is working fine in our test site and showing no errors .
add_filter('wplms_assignments_metabox','custom_explantion'); function custom_explantion($wplms_assignments_metabox){ $wplms_assignments_metabox[]=array( // Single checkbox 'label' => __('Explanation','vibe-customtypes'), // <label> 'desc' => __('Assignment explanation','vibe-customtypes'), // description 'id' => $prefix.'explanation', // field id and name 'type' => 'editor', // type of field 'std' => '' ); return $wplms_assignments_metabox; } add_action('wplms_assignment_after_content','show_explanation'); function show_explanation(){ global $post; if(is_user_logged_in()){ $user_id=get_current_user_id(); $user_time = get_user_meta($user_id,$post->ID,true); $assignment_time = get_post_meta($post->ID,'vibe_assignment_duration',true); $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter',86400); $expiry = $user_time+$assignment_time* $assignment_duration_parameter; $assignment_finished = get_post_meta($post->ID,$user_id,true); if(isset($assignment_finished) && is_numeric($assignment_finished) && $expiry < time()){ $explanation= get_post_meta( $post->ID,'explanation',true); if(isset($explanation) && !empty($explanation)) echo apply_filters('the_content',$explanation); } } }
October 14, 2015 at 5:53 pm #3010mesrickSpectatorGot it working. -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
- The topic ‘Assignment Answer Customization Reimplementation’ is closed to new replies.