• Notices break execution when post is submitted and display all over the admin with WP_DEBUG turned on. Issue is right here:


    if ($settings === false) {
    $settings = self::default_data();
    }

    $settings['message'] = array(
    'cc_email' => $settings['message']['cc_email'] != '' ? $settings['message']['cc_email'] : $default_data['message']['cc_email'],
    'bcc_email' => $settings['message']['bcc_email'] != '' ? $settings['message']['bcc_email'] : $default_data['message']['bcc_email'],
    ...

    You’re using the $default_data variable but you never declare that variable. However, you’re setting the default data in your $settings variable if there are no settings defined, so it seems like this is just copy past and you don’t even need to use the tertiary statements.

    This is a quick hack that solves the problem:


    // Default values
    $default_data = self::default_data();

    if ($settings === false) {
    $settings = self::default_data();
    }

    …however changing the $settings variables to not use tertiary statements would work, too, e.g. :


    $settings['message'] = array(
    'cc_email' => $settings['message']['cc_email'],
    'bcc_email' => $settings['message']['bcc_email'],
    ...

    Your settings values would never be '' if you are defining them properly in self::default_data().

    Screenshot of error: https://www.dropbox.com/s/n1jdbrvgqbe7v3k/centralmarket_dev_wp-admin_post_php.png?dl=0
    https://www.ads-software.com/plugins/wpsite-post-status-notifications/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined variable notices all over the admin’ is closed to new replies.