Next chapter Coursepress not working correctly

Dear WPMUDEV,

I have no clue how it happend, but next to the problems i experience with the withdraw button firing wrongfully.. since a few weeks my "next" in course units does not function..

I get this message in the console when i press it:

resource interpreted as Document but transferred with MIME type application/json: "https://www.gbsgprogram.com/course/market-analysis/units/background-2/".

VM9103:2 Uncaught SyntaxError: Unexpected token W in JSON at position 1
at JSON.parse (<anonymous>:wink:
at front.js?ver=2.0.2:741
(anonymous) @ front.js?ver=2.0.2:741

I opened up support..

Hope we can fix it.. I need to go live in 1.5weeks XD

Greetings,
Simon

  • Simon

    Ok... I fixed it... However, it came from an unsuspected file...

    The problem I experienced was based in the Events+ plugin as well as the set_time_limit function.

    I out-commented the set_time_limit function and after it a new error appeared.

    This error was related to the event-and-bookings.php file

    After out-commenting the whole inside of the function starting on line 388 the pager worked again.

    Can you please check why this is the case?

    Since it seems that it doesn't effect anything on the site

    Kind regards.

    Simon

  • Adam Czajczyk

    Hello Simon!

    The "set_time_limit()" function is a standard PHP function (PHP 4, 5, 7) and I must admit that I'm surprised your host is blocking it. I do not have a way to test that unfortunately (I'm don't have access to environment where that function would be/could be blocked) but I'll raise that with developers so they could investigate that.

    However, could you please tell me first where do you host your site (a link to hosting plan description would be great)?

    I would also make sure about the code that you commented out from "events-and-bookings.php" file. It looks to me like that is the code related to Google Maps plugin but could you please post that commented code here?

    Looking forward to your replay,
    Adam

  • Simon

    Hello Adam,

    I was surprised as well... but my hosting provider blocks it server wide to increase security. I asked them why as well :wink:

    My hosting party = https://www.transip.nl/webhosting/

    The out commented code is:
    (it indeed is the google maps plugin, but it didn't work correctly either way on my installation.. even after adding the API myself)

    function agm_google_maps_post_meta_address($location) {
    		global $post;
    
    		/*if (!$location && $post->post_type == 'incsub_event') {
    		    $meta = get_post_custom($post->ID);
    
    		    $venue = '';
    		    if (isset($meta["incsub_event_venue"]) && isset($meta["incsub_event_venue"][0])) {
    				$venue = stripslashes($meta["incsub_event_venue"][0]);
    				if (preg_match_all('/map id="([0-9]+)"/', $venue, $matches) > 0) {
    				    if (isset($matches[1]) && isset($matches[1][0])) {
    						$model = new AgmMapModel();
    						$map = $model->get_map($matches[1][0]);
    						$venue = $map['markers'][0]['title'];
    						if ($meta["agm_map_created"][0] != $map['id']) {
    						    update_post_meta($post->ID, 'agm_map_created', $map['id']);
    						    return false;
    						}
    				    }
    				}
                                    else
                                    {
                                            delete_post_meta( $post->ID, 'agm_map_created' );
                                    }
    		    }
    
    		    return $venue;
    		}
    		return $location;*/
        }
  • Adam Czajczyk

    Hello Simon!

    Thank you for your response.

    That is the code that I found so thank you for confirmation. I must say though that even though I tried various combinations/options of CoursePress, Events+ and Google Maps plugins, I wasn't able to "force it" to produce any relevant error or find how that code could affect CoursePress.

    Can you tell me please if you are using our Google Maps plugin along CoursePress and Events+? If you un-comment that maps' code, what is an exact error? It would be great if you could test it and share with me here.

    As for the "set_time_limit()" function. I checked the code and I think it may indeed be safely commented out. The point here is to increase the PHP script execution timeout to let CoursePress process "indefinitely" as it may sometimes need more time to complete. I'm not sure how important that is though and since apparently it may be blocked on some hosts, I have reported it to the developers so they could take care of it.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.