• Resolved mcserban

    (@mcserban)


    Since I installed Sparkpost plugin, my cron jobs are not working.
    I am getting the following error:
    PHP Parse error: syntax error, unexpected T_FUNCTION in wordpress-sparkpost.php on line 38

    This is the line:
    add_filter(‘wp_mail’, function ($args) {
    global $phpmailer;
    if (!$phpmailer instanceof SparkPostHTTPMailer) {
    $phpmailer = new SparkPostHTTPMailer();
    }
    return $args;
    });

    I am using PHP 5.3 and wordpress 4.4.2
    Can someone help me?
    Thanks

    https://www.ads-software.com/plugins/sparkpost/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor rajuru

    (@rajuru)

    Hello @mcserban
    The error looks like due to the anonymous method. Are you sure you’re using PHP ~5.3.0? It should be fine with php5.3.

    Thread Starter mcserban

    (@mcserban)

    Changed the code as below and it works now:

    function myphpmailer ($args) {
    global $phpmailer;
    if (!$phpmailer instanceof SparkPostHTTPMailer) {
    $phpmailer = new SparkPostHTTPMailer();
    }
    return $args;
    }
    add_filter(‘wp_mail’,’myphpmailer’);

    Thread Starter mcserban

    (@mcserban)

    @rajuru – you are right. My cron runs on php 5.2, but my website on 5.3.

    Plugin Contributor rajuru

    (@rajuru)

    @mcserban
    Your fix will work. Also we’ll be releasing (today/tomorrow) a newer version that will also fix this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cron job – not working due to plugin’ is closed to new replies.