Maybe a critical bug
-
I installed the latest version 1.3.14, although it does not work as I expected.
Even if a form with a checkbox checked is submitted, the subscriber is not on the list.So, I have taken a look at sources. I seems to find a bug in the source; class-mailpoet-cf7-submit-form.php:
try { $subscriber = \MailPoet\API\API::MP( 'v1' )->addSubscriber( $subscribe_data, array_unique( $list_ids ), $options ); } catch ( Exception $exception ) { //If subscriber is already subscribed once and unsubscribed later, then again subscribed to any list, change the status to subscribed and add to the list //if ( 'This subscriber already exists.' == $exception->getMessage() ) { if ( $exception->getCode() == \MailPoet\API\MP\v1\APIException::SUBSCRIBER_EXISTS ) { //Change subscriber status to subscribed $subscribe_data['status'] = 'subscribed';
The site that I maintain speaks Japanese. Thus, the message ‘This subscriber already exists.’ in the source would be returned in Japanese. Therefore, even if the subscriber already exists, the == equation would result in failure.
The workaround I took is to use getCode() not getMessage() as shown the above.
In my site, this way works fine at the present time.I hope this would be helpful to enhance the quality of your plugin.
Many thanks in advance.
- The topic ‘Maybe a critical bug’ is closed to new replies.