M2 and CoursePress conflict

I have two issues:
1. When only M2 and CoursePress are active together in a subsite, unit can't be saved. It says a timeout error.
2. In every update M2 is updated by the free version, how can I make sure that it stays as pro?

  • Lindeni Mahlalela

    Hello Jonathan

    I hope you are doing great today. We are still looking into this issue, unfortunately we haven't found the root of the issue and thus we haven't found a solution yet but here is what we have found so far.

    There are several issues manifesting as server configuration issues or resource limitations when saving the units on the course. Very often, the serve goes to a timeout error like this:

    This means the server takes too long to render the page and it reaches the max_execution_time limit. I have tried to raise this limit but still the server times out at some point.

    When saving units, it keeps loading until it returns a "500 Internal Server Error" on the file /wp-admin/admin-ajax.php which is used to save the units. I have tried several times with this and multiple times I verified that actually the units are saved but there is no response or feedback to say the units were saved. If I then refresh the page I see the changes I have made on the unit. This could be related to the server's response headers or directly with the Internal Server Error, if the internal server error occurs then of course CoursePress will not get the response it expects and so will not update or give feedback as to whether the units were saved or not. I also checked the HTTP Headers on the console and found that when this happens, the response data is empty meaning the server did not return anything to CoursePress.

    The good news is that the changes are being saved but only no feedback to let you know once that has been done, so I guess you can still do your work while we continue to investigate this from our side.

    Once it reaches this, the server breaks the connection and WordPress shows this error:

    After trying several things, I have duplicated the course (it made a copy of everything except students) and after that I edited the duplicate, it turns out that I was able to save everything properly when on the duplicated course. I am not sure what courses this and I have to ask the developers' insight on this.

    I also found that when it throws the server error relating to timeout, it also throws this error in web console

    I am sorry that we do not have a solution as yet but I assure you that we are working on this and we will update as soon as possible. We appreciate your patience, please let us know if there is any information you wish to add or any questions you may have.

    Have a nice day.
    Mahlamusa

  • Jonathan

    Thank you for your hard work.

    So just to give you more information. The issue started after 2 things happened to my site.

    1: the database was accidentally deleted, then created again, could it be that courspress is now not configured correctly with the database?

    2: Membership Pro update - which switched back to the free membership.

    When I deactivate all plugins it seems to communicate grand with the server and there is no issue with saving etc. Then if i activate membership the connection errror happens again.

    3: There seems to be a connection error with that subsite in general, when courspress loads slow the entire subsite loads slow

    Hope some of this helps,

    and i appreciate the help with this issue.

    Jon

  • Lindeni Mahlalela

    Hello Jonathan

    I hope you are doing great today. With regards to the certification, you have to go to the course dashboard and grade each student after they complete the course, you review their work, give feedback and grade the students then the certificates will be generated.

    To achieve this you will have to go to "CoursePress > Assessments" choose a student and view their Workbook and you will be able to grade them there. I am checking your course and the students list and it seem most students are certified, how did you do that? Did this stop working all of a sudden or you are talking about something else? I have checked a couple student workbooks and have seen that they have failed.

    Do you have a student we can use to test and see if we can grade or certify them?

    We are still waiting for the senior developers on the other issue regarding the conflict between Membership 2 and CoursePress, please note that the developers deal with a lot of complex issues and may take time to respond but once they do we will update you regarding their feedback.

    Have a nice day.
    Mahlamusa

  • Jonathan

    Students have always got certified automatically, in coursepress you set the passing overall grade and then you set a grade for an exam, once a student completes all modules and passes the exam they are certified???

    I have never had to manually do this. If you are not familiar with coursepress and its inner workings I would rather you did not access my site as there is obviously some major issues with the plugins at the moment, I have already lost students (and money) and the website is barely functioning at the moment while I am waiting 2 days on your developers. I can not afford to loose any more money with this isssue.

    Thank you for your time but I am anxiously awaiting your developers reply

  • Panos

    Hi there Jonathan ,

    Students have always got certified automatically, in coursepress you set the passing overall grade and then you set a grade for an exam, once a student completes all modules and passes the exam they are certified

    This is true only when the modules do not required to be reviewed by an instructor, like choices and selectable modules. When it is text then it won't be automatically passing that. So this is not how plugin works, they should be assessed manually as Lindeni mentions above.

    The proper way requires some custom coding as it needs to go through all units and modules each course has and insert a mark value for each. You need to hire a developer for that though as it extends the support we can provide here. I can provide another approach, which kinda cheats cp assessments:

    add_action( 'admin_init', function(){
    
    	$students = array( 9, 10, 11, 12 );
    	$courses = array( 777, 785 );
    
    	foreach( $students as $student_id ){
    		foreach( $courses as $course_id ){
    
    			$is_enrolled = CoursePress_Data_Course::student_enrolled( $student_id, $course_id );
    
    			if( ! $is_enrolled ) {
    				CoursePress_Data_Course::enroll_student( $student_id, $course_id );
    			}
    
    			$meta_key = sprintf( '_course_%d_completed', $course_id );
    			update_user_meta( $student_id, $meta_key, true );
    
    			$data = get_user_option( 'course_' . $course_id . '_progress', $student_id );
    
    			if( empty( $data ) ){
    				$data = array();
    			}
    
    			$data[ 'completion' ][ 'completed' ] = true;
    
    			update_user_option( $student_id, 'course_' . $course_id . '_progress', $data );
    			CoursePress_Data_Certificate::generate_certificate( $student_id, $course_id );
    
    		}
    	}
    
    }, 10 );

    This will not add any assessments, however in each check it should consider the student as certified.

    You can test this script on a testing site, please do not use it on your live site without testing what it does.

    You will need to replace the user ids and course ids in the script with your own ones. Also you need to run this only once. You can add it in a mu-plugin, load an admin page then delete that script.

    Hope this helps a bit!

    Cheers!

  • Jonathan

    Hi Panos,

    The courpress plugin was working fine for me, I only have videos and an exam at the end with multiple choice questions so students are automatically certified. The issue is that I am unable to make any changes as there is a conflict with membership pro 2 it looks like. Any changes I make to the course I get a time out.

    This issue has now being going on over a week with no resolve, can you please update on the original issue and what is being done or investigated on a daily basis