Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi both… I’d thought it looked like a longstanding bug in the Divi theme and no one had been using it… so interesting a few others are also seeing it.

    The error message itself comes from line 357 of MailPoet’s API.php (/mailpoet/lib/API/MP/v1/API/php), in the function getSubscriber(); an exception is thrown when this function is called and the subscriber doesn’t exist.

    However the issue is not there, as that is correct behavior, but within the calling function within the Divi theme files, \Divi\core\components\api\email\_MailPoet3.php, line 165 within the subscribe() function. This should handle the exception gracefully as an expected response when the user is new.

    I’ve changed the code that checks if a subscriber already exists as follows:

    /**
    
    * Check if the subscriber with this email already exists.
    
    */
    
    try {
    
    $subscriber = \MailPoet\API\API::MP( 'v1' )->getSubscriber( $subscriber_data['email'] );
    
    } catch ( \MailPoet\API\MP\v1\APIException $exception ) {
    
    switch ($exception->GetCode()) {
    
    case \MailPoet\API\MP\v1\APIException::SUBSCRIBER_NOT_EXISTS:
    
    // valid result when subscriber does not exist; do nothing
    
    break;
    
    default:
    
    $result = $exception->getMessage();
    
    }
    
    } catch ( Exception $exception ) {
    
    $result = $exception->getMessage();
    
    }

    I’ve sent this to Elegant Themes in response to the ticket so hopefully they’ll patch a subsequent version of Divi directly.

    I’ve not looked at putting this into a child theme, but I guess that would be the right way to temporarily fix this until Divi to issue an update.

    • This reply was modified 3 years, 9 months ago by olicuk. Reason: added further detail
Viewing 1 replies (of 1 total)