One of the units causing 500 error

In one of the courses, the second unit is causing 500 Internal Server Error. Please, help me to solve the issue.
There is a query on that page that is taking longer than 60seconds to complete.

  • Panos
    • SLS

    Hi there morfjord ,

    It seems that the reason is that there is no page title set for the Page in that unit, which leads to mis-count of pages and it times out.

    By forcing the page count I by-passed this and page loaded.

    I would still like to do further testing, but it seems that after load the cached page is served which doesn't allow any testing as it loads the page now.

    Could you please deactivate cache temporarily on the staging site until we complete the testing?

    Kind regards!

  • Panos
    • SLS

    Hi morfjord ,

    I supposed there was some sort of cache, as whatever changed I did in file, after the page loaded, it would not make any affect. Anyhow I could replicate in my installation after importing this course, so I continued testing there.

    As for not being able to update the name this is really strange and I could replicate this in my test site too. I noticed some meta values that are not part of CoursePress eg:
    module type has value ead-document
    CoursePress has specific module types and this is not one of them

    another indication is that for unit where the page title wasn't be saved, is that it has the meta being repeated several times.

    So I assume that there have been some custom modifications or inserts. This also affected the Intro unit, that was not loading the units in admin for me.

    I would suggest for such problematic units to re-create them. I understand that this sounds as too much work also might lose potential student progress. For those reasons I prepared a custom mu-plugin that would clone modules and their student's progress. This is not an official plugin of ours and we can't provide support for it. So before using it, please keep a backup and also test on a staging site.

    The idea is to create a new unit, where the page editing/insert works, then use the mu-plugin which would fetch the exact same modules without needing to manually re-write them. So, if you agree with this plan, first go and create this new unit.

    Then you can download the mu-plugin from here
    https://gist.github.com/wpmudev-sls/c1d9579172faabf64fef4f77a4912d08

    It doesn't have a good ui, but it is very simple to use. It creates a new sub-menu at the CoursePress admin menu called "Copy Unit Modules".

    In the "Insert Source Module" text box insert the unit id from where you need to copy the modules from, and in the "Insert Target Module" box, insert the id of the new unit you created. You can use your browser's "Inspect" tool, to get the id's of the units. In the following screenshot the unit id is in data-tab attribute, which is 921:

    Once you added both ids, click on the "Clone" button.

    Once it's done, it should have copied the modules from you original unit, to the new unit in which you can also save the page title and should not have issues in the front end.

    Hope you find this suggestion helpful!

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.