Assignment Answer Customization Reimplementation

Home Forums Legacy Support Support queries Other issues Assignment Answer Customization Reimplementation

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2087
    mesrick
    Spectator
    Hi, 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.
    #2354
    Anshuman Sahu
    Keymaster
    Here 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);         }     } }
    #2570
    mesrick
    Spectator
    Whenever I add this code, if breaks my site. Should I be adding this to a child theme or main theme?
    #2925
    Anshuman Sahu
    Keymaster
    Add 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);
    
            }
    
        }
    
    }
     
    #3010
    mesrick
    Spectator
    Got it working.
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Assignment Answer Customization Reimplementation’ is closed to new replies.