• Resolved Birgit Olzem

    (@coachbirgit)


    Installed the plugin on two different environments (InstaWP with WP 6.3.1 and local setup 6.4-beta3)

    The activation throws a fatal error caused by the /course-booking-system/includes/db/update.php?on line?118

    deactivate_plugins( '/mp-timetable/mp-timetable.php' );

    I assume this line doesn’t belong there.

    After a quick check using find in folder search in Sublime Text, I found 7 matches for mp-timetable across two files

    /course-booking-system/course-booking-system.php:

    474: $directory = get_template_directory().'/mp-timetable/';

    /course-booking-system/includes/db/update.php:

    112: $wpdb->query( "UPDATE ".$wpdb->prefix."posts SET post_content = REPLACE(post_content, '[mp-timetable', '[timetable') WHERE post_content LIKE ('%[mp-timetable%')" );
      115: 	$wpdb->query( "UPDATE ".$wpdb->prefix."postmeta SET meta_value = REPLACE(meta_value, '[mp-timetable', '[timetable') WHERE meta_value LIKE ('%[mp-timetable%') AND meta_key = '_elementor_data'" ); // Elementor
      118: 	deactivate_plugins( '/mp-timetable/mp-timetable.php' );

    I wonder if there is a reason for not checking first if a plugin called mp-timetable is installed before firing the deactivate_plugins hook.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Birgit Olzem

    (@coachbirgit)

    Workaround to fix the fatal error

    Replace in /course-booking-system/includes/db/update.php line 118

    if ( is_plugin_active( '/mp-timetable/mp-timetable.php' ) )
    deactivate_plugins( '/mp-timetable/mp-timetable.php' );

    with the corrected syntax below

    // Check if the plugin is active
    if ( is_plugin_active( 'mp-timetable/mp-timetable.php' ) ) {
        // Deactivate the plugin
        deactivate_plugins( 'mp-timetable/mp-timetable.php' );
    
    }

    Plugin Author ComMotion

    (@werbeagenturcommotion)

    Hi Birgit, thank you for your message and your workaround.

    In prior versions we used the MP Timetable Plugin to show our courses. Since version 5.0 we use our own environment to display all our courses. To support older versions, we use the update.php to make the update process seamless.

    We could not reproduce the error on our own system, so probably it is a problem with certain PHP versions. Which PHP version are you currently using in your two environments? We will dive into that and will provide an update in the coming version as soon as possible for everyone.

    I appreciate your message. Thank you.

    Thread Starter Birgit Olzem

    (@coachbirgit)

    It happens on PHP 7.4 and PHP 8.0 on every install, I tried to activate the plugin. Locally on Laravel Valet, on InstaWP or on a shared host.

    Fatal error: Uncaught Error: Call to undefined function is_plugin_active()
    in /home/yebigegoja8566/web/bored-bee-gvf61.instawp.xyz/public_html/wp-content/plugins/course-booking-system/includes/db/update.php on line 118

    Plugin Author ComMotion

    (@werbeagenturcommotion)

    Hi Birgit, thank you for the error message. We are still very curious, why this throws an error, because the function is_plugin_active() is a common WordPress function. Also both syntaxes of your two provided codes above (our code and your workaround) are valid.

    We are taking over your workaround from above to avoid future problems and we are hoping this helps others. Thank you for your effort. We really appreciate your help in this topic.

    Thread Starter Birgit Olzem

    (@coachbirgit)

    The problem still exists.

    You can take a look for yourself. Even with the quick tool from TasteWP it throws a fatal error on 7.4 with 6.4.2 and Twenty Twenty Three!

    https://tastewp.com/plugins/course-booking-system/

    Plugin Author ComMotion

    (@werbeagenturcommotion)

    Hi Birgit,

    thank you again for your message. Please try our newest update of the plugin in the version 5.1.9 where we fix the bug on activation. We tested it via https://tastewp.com/plugins/course-booking-system/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Version 5.1.3 causes Fatal Error on activation’ is closed to new replies.