Assignment Answers/Explanations

Home Forums Legacy Support Support queries How-to & Troubleshooting Assignment Answers/Explanations

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #55327
    mesrick
    Spectator
    We had you guys do a customization a while back such that assignments would display an explanation/answer to students only after they submit that assignment. I was provided with the following code, but it no longer works. I was hoping for an update/fix:
    add_filter('wplms_assignments_metabox','custom_explantion');
    function custom_explantion($wplms_assignments_metabox){
        $wplms_assignments_metabox[]=array( // Single checkbox
            'label' => __('Explanation','vibe-customtypes'), //
            '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);
      }
     }
    }
    #55407
    H.K. Latiyan
    Participant
    In the above code change the first line add_filter('wplms_assignments_metabox','custom_explantion'); to add_filter('wplms_wplms-assignment_metabox','custom_explantion');   Let me know if this helps.
    #55466
    mesrick
    Spectator
    That worked. Thank you very much.
    #55530
    H.K. Latiyan
    Participant
    Thanks for confirming, so closing the topic.
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Assignment Answers/Explanations’ is closed to new replies.