Prevent Answer field from being "completed"

Hello, our goal with this plugin is to be used as an online workbook. Right now our ministry members fill out writable PDF's when working on the lessons (example: http://cdn.compasschurch.org/files/women/wbs/judges/lessons/lesson-14-palm.pdf). This plugin would replace the writable PDF's so that the members of our different ministries could go online and fill out the lesson for the week via their desktop, ipad/iphone ext. My question is how can I have it so that our members can work on a lesson (unit) and answer the questions/ save it at any time and come back to it and add/change their answers without the answer field being shown as completed?

Also, with the plugin Sensei, by Woothemes, I was able to add this to my functions.php to inherit my page styling is that possible with this plugin?

// Removes Woothemes Sensei default Wrappers

global $woothemes_sensei;
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );

//Adds CBC Theme Wrappers

add_action('sensei_before_main_content', 'my_theme_wrapper_start', 10);
add_action('sensei_after_main_content', 'my_theme_wrapper_end', 10);

function my_theme_wrapper_start() {
  • Vinod Dalvi

    Hi @dmayer5,

    Welcome to the WPMU Dev community and thank you for your question.

    My question is how can I have it so that our members can work on a lesson (unit) and answer the questions/ save it at any time and come back to it and add/change their answers without the answer field being shown as completed?

    You can achieve this by setting Unit element field "Limit Attempts" to the more number like 50 as displayed in the attached screenshot.

    Also, with the plugin Sensei, by Woothemes, I was able to add this to my functions.php to inherit my page styling is that possible with this plugin?

    It's possible with this plugin by overwriting its template files in your child theme.

    You can refer the default CoursePress theme on the following path to create these template files.

    wp-content/plugins/coursepress/themes/coursepress

    Please advise if you have more questions.

    Best Regards,
    Vinod Dalvi

  • dmayer5

    The problem that I see with that solution is that I will need to manually go into each answer assessment for each student and put in an answer that they wouldn't "submit" in order for them to to be able to change their answer. I want our members to be able to fill in the box and come back at anytime to add to the box without me needing to go to the Assessment section to check their answer. Basically this plugin would be used at a note taking plugin (replacement of the PDF's that are on our website right now.) So is there a modification I can make to the PHP coding that would prevent the multiple line answer field from being greyed out?

  • dmayer5

    I know this controls whether or not the answer has been completed: `public static function get_response( $user_ID, $response_request_ID, $status = 'publish', $limit = 1, $ids_only = false ) {
    $already_respond_posts_args = array(
    'posts_per_page' => $limit,
    'post_author' => $user_ID,
    'author' => $user_ID,
    'post_type' => 'module_response',
    'post_parent' => $response_request_ID,
    'post_status' => 'publish'
    );

    if ( $ids_only ) {
    $already_respond_posts_args['fields'] = 'ids';
    }

    $already_respond_posts = get_posts( $already_respond_posts_args );

    if ( isset( $already_respond_posts[0] ) && is_object( $already_respond_posts[0] ) ) {
    $response = $already_respond_posts[0];
    } else {
    $response = $already_respond_posts;
    }

    return $response;
    }`

    However, I can't figure out how to alter the coding so that the text inputed by the user is saved, and allows them to add to it at another time. The point again is for our users to take notes on the questions we have for them.

  • dmayer5

    I can done more digging around and found this within coursepress > includes > classes > class.course.unit.module.php

    public static function did_student_respond( $unit_module_id, $student_id ) {
    			//Check if response already exists ( from the user. Only one response is allowed per response request / module per user )
    			$already_respond_posts_args = array(
    				'posts_per_page' => 1,
    				'meta_key'       => 'user_ID',
    				'meta_value'     => $student_id,
    				'post_type'      => array( 'module_response' ),
    				'post_parent'    => $unit_module_id,
    				'post_status'    => array( 'publish', 'inherit' )
    			);
    
    			$already_respond_posts = get_posts( $already_respond_posts_args );
    
    			if ( count( $already_respond_posts ) > 0 ) {
    				return true;
    			} else {
    				return false;
    			}
    		}

    Still not sure how to manipulate it so that the answers can remain editable.

  • Vinod Dalvi

    Hi @dmayer5,

    Thank you for your detailed reply.

    You can achieve this developing custom code but developing custom code for custom functionality is beyond the scope of support that we provide. See here : https://premium.wpmudev.org/manuals/using-wpmu-dev/support-vs-custom-development/

    I will move this over to the features & feedback section. This way it can be considered for future development, and we can also see what other community members think about the feature request.

    If you are not a programmer then you can consider hiring a developer from https://premium.wpmudev.org/wpmu-custom-development/ to develop for you.

    Any other issues, we're here to help.

    Thank you for being a WPMU DEV member and have a fantastic day!

    Thanks,
    Vinod Dalvi