Possible to accept students immediately even with manual payments?

I'm only using manual payments in coursepress/marketpress. However, I would like the student to get access to the course right after the order process. Is there a way to do this with 1. settings or 2. "hacking"?

By default the process is that the student goes through the buying process, I mark them as paid, they get access, I send the bill, they pay.

I need it to be: student goes through the buying process, they get access, I send the bill, they pay.

  • Bojan Radonic

    Hey there @Outi, hope you're well today!

    I've consulted plugin developer on this one and this is what he told me. Could you please open coursepress.php which is located in the root folder of your plugin. Open it with the text editor of your choice and go to line 11327 and replace function listen_for_paid_status_for_courses with this one here:

    function listen_for_paid_status_for_courses( $order ) {
    global $mp;
    
    $allowed_mp_statuses = apply_filters( 'cp_allowed_purchase_status_for_enroll', array( 'order_paid' ) );
    
    if ( in_array( $order->post_status, $allowed_mp_statuses ) ) {
    $product_id = key( $order->mp_cart_info );
    
    $course_details	= Course::get_course_id_by_marketpress_product_id( $product_id );
    $course_details	= (int) $course_details;
    if ( $course_details && !empty( $course_details ) ) {
    $student = new Student( $order->post_author );
    $student->enroll_in_course( $course_details );
    }
    }
    }

    You don't have to be worried about losing changes when you update the plugin since this filter will be added into the next CoursePress update.

    When done with that please add the following filter to your theme functions.php:

    add_filter( 'cp_allowed_purchase_status_for_enroll', 'custom_cp_mp_status', 10, 1 );

    function custom_cp_mp_status( $order_statuses ) {
    $order_statuses = array( 'order_paid', 'order_received' );
    return $order_statuses;
    }

    This should get your students to have access before they pay. Hope this helps :slight_smile:

    Best regards,
    Bojan

  • Bojan Radonic

    Hey again @Outi,

    That's weird, I've double checked this again and it is possible that you're somehow not looking at the same file? The file is located in /wp-content/plugins/coursepress/ and the function is on the line 11327, see screenshot.

    Additionally which version of the plugin are you using?

    If you still can't do this could you please send us your details through our contact form https://premium.wpmudev.org/contact/ using this template:

    Subject: "Attn: Bojan"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    Best regards,
    Bojan