I just posted on the CoursePress losing units thread but

I just posted on the CoursePress losing units thread but wanted to open a new ticket here to see if there is any easy way to restore a lost unit?

I am running 1.2.4.7. Clicked save and unit was gone

  • Kent

    By the way, the logic seems fuzzy to me. If the max input vars are exceeded, wouldn't it still display up to the limit. For example if my max_input_vars is 100 and I add additional content such that I now have 110 variables, wouldn't the unit builder still display up to 100? I modified the content only slightly--maybe adding one or two variables. But when I clicked save it wiped out 50 variables and is now only displaying 50 variables despite my max_input_vars being set at 100. It doesn't make sense that it would wipe out the entire unit. If it wiped out half the unit, maybe that would make sense?

  • Adam Czajczyk

    Hey Kent!

    I hope you're well today and thank you for your questions.

    You asked if the unit content should re-appear after you added „max_input_vars = 10000” to your php.ini and „php_value max_input_vars 10000” to .htaccess file.

    First of all let's clarify that the php variable doesn't equal the CoursePress Pro unit. The way things work is that every unit – as stated by the developer Marko Miljus – is built of many variables. When the greater number of variables is being passed to the server, the server strips those that exceed the limit.

    Let's assume that the particular unit you're trying to save consists of variables number 9998, 9999, 10000, 10001 and 10002. In such case only the first two variables (counting from number 0 as first) will be passed to the server, but remaining three are also necessary for the unit to be saved. Lack of those variables will result in the unit being lost because of being incomplete.

    Rising the „max_input_vars” value will not bring back lost units that weren't saved. My reccomendation for you would be to perform two steps:

    1. Please verify if „max_input_vars” limit is indeed set. To do that create a test php file on your server that contains the following code

    <?php phpinfo(); ?>

    File should be placed in the same location as your .htaccess file. Now open that file in your browser and search for the „max_input_vars” variable. Sometimes setting this directive via .htaccess just doesn't work and also not every hosting provider alows you to define your own php.ini file.

    2. If „max_input_vars” setting works then try to rise it even higher (significantly higher) and then create and save new unit again.

    Hope that helps.

    Cheers,
    Adam