Compare commits

...

3 Commits

Author SHA1 Message Date
bf9f77b861 Release 3.87.1 2022-04-14 10:44:08 +02:00
4ab67af847 Quote emails when inserting/updating WooCommerce subscribers
[MAILPOET-4248]
2022-04-14 10:37:43 +02:00
afbc91a5c2 Separate insert from update on duplicate
[MAILPOET-4248]
2022-04-14 10:37:37 +02:00
3 changed files with 17 additions and 5 deletions

View File

@ -306,13 +306,21 @@ class WooCommerce {
$now = (Carbon::createFromTimestamp($this->wp->currentTime('timestamp')))->format('Y-m-d H:i:s');
$source = Source::WOOCOMMERCE_USER;
foreach ($emails as $email) {
$subscribersValues[] = "(1, '{$email}', '{$status}', '{$now}', '{$now}', '{$source}')";
$email = strval($this->connection->quote($email));
$subscribersValues[] = "(1, {$email}, '{$status}', '{$now}', '{$now}', '{$source}')";
}
// Update existing subscribers
$this->connection->executeQuery('
UPDATE ' . $subscribersTable . ' mps
SET mps.is_woocommerce_user = 1
WHERE mps.email IN (:emails)
', ['emails' => $emails], ['emails' => Connection::PARAM_STR_ARRAY]);
// Insert new subscribers
$this->connection->executeQuery('
INSERT IGNORE INTO ' . $subscribersTable . ' (`is_woocommerce_user`, `email`, `status`, `created_at`, `last_subscribed_at`, `source`) VALUES
' . implode(',', $subscribersValues) . '
ON DUPLICATE KEY UPDATE is_woocommerce_user = 1
');
return count($emails);
@ -485,6 +493,7 @@ class WooCommerce {
if ($this->needsCollationChange()) {
$collation = "COLLATE $this->mailpoetEmailCollation";
}
$this->connection->executeQuery("
CREATE TEMPORARY TABLE {$tmpTableName}
(`email` varchar(150) NOT NULL, UNIQUE(`email`)) {$collation}

View File

@ -2,7 +2,7 @@
/*
* Plugin Name: MailPoet 3 (New)
* Version: 3.87.0
* Version: 3.87.1
* Plugin URI: http://www.mailpoet.com
* Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
* Author: MailPoet
@ -17,7 +17,7 @@
*/
$mailpoetPlugin = [
'version' => '3.87.0',
'version' => '3.87.1',
'filename' => __FILE__,
'path' => dirname(__FILE__),
'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',

View File

@ -3,7 +3,7 @@ Contributors: mailpoet
Tags: email, email marketing, post notification, woocommerce emails, email automation, newsletter, newsletter builder, newsletter subscribers
Requires at least: 5.6
Tested up to: 5.9
Stable tag: 3.87.0
Stable tag: 3.87.1
Requires PHP: 7.2
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -218,6 +218,9 @@ Check our [Knowledge Base](https://kb.mailpoet.com) or contact us through our [s
== Changelog ==
= 3.87.1 - 2022-04-14 =
* Improved: minor changes and fixes.
= 3.87.0 - 2022-04-11 =
* Added: new condition (at least 10 emails in lifetime) before marking subscriber as inactive;
* Added: logging for failed MailPoet key validation checks;