Skip to content

Commit

Permalink
Merge pull request #216 from mailjet/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
JasenAngelov authored Jun 5, 2019
2 parents 867f0b4 + 3402956 commit 58ab7bc
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 155 deletions.
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
- Contributors: Mailjet
- Tags: email, marketing, signup, newsletter, widget, smtp, mailjet
- Requires at least: 3.9
- Tested up to: 5.2
- Stable tag: 5.1.0
- Tested up to: 5.2.1
- Stable tag: 5.1.1
- Requires PHP: 5.6
- License: GPLv2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -14,7 +15,8 @@ Use Mailjet to create, send and track beautiful and engaging marketing and trans
* The all new V5 Mailjet plugin for Wordpress has been completely redesigned and includes many new features.
* Improved plugin settings for simplified configuration
* Redesigned subscription widget for easier setup and more options - mandatory, optional or hidden form fields, custom subscription confirmation page, and more.
* Integration with WooCommerce is included - customers can subscribe to your newsletter during checkout. More integrations are coming soon.
* Integration with **Contact Form 7** - add a "Subscribe to our newsletter" checkbox to any Contact Form 7 form and easily add subscribers to your contact lists
* Integration with **WooCommerce** - customers can subscribe to your newsletter during checkout. More integrations are coming soon.
* More flexibility - use filters to set your own subscription confirmation email template or texts inside the email, set your own thank you page, or widget form.

## Description
Expand All @@ -25,12 +27,15 @@ Mailjet's official plugin on WordPress gives you access to:

* **Sign Up Form & Contact Lists Management:** Create and customize contact form widgets to allow your website visitors to subscribe to your newsletters.

* **Automated Contact Synchronization** - 3 ways to build your contact lists:
* Synchronize your WordPress contacts. The user role is added to Mailjet as a contact property, so you can filter and target marketing emails to the proper group. With ongoing synchronization, you never have to think about contact management again.
* **Automated Contact Synchronization** - 4 ways to build your contact lists:

* Synchronize your WordPress contacts. The user role is added to Mailjet as a contact property, so you can filter and target marketing emails to the proper group. With ongoing synchronization, you never have to think about contact management again.

* Comment authors can be added to a separate Mailjet contact list as they choose to subscribe while posting a comment on the blog.

* A new cool option is to subscribe WooCommerce customers to your newsletter during checkout. Just enable the WooCommerce integration inside the plugin and you are ready to go.

* Subscribe WooCommerce customers to your newsletter during checkout. Just enable the WooCommerce integration inside the plugin and you are ready to go.

* Use the built in Contact Form 7 integration and allow form submitters to subscribe to your newsletter.

* **Campaign Builder Tool:** Use our drag and drop email editor or HTML builder to create beautiful and engaging emails - directly from your WordPress admin.

Expand Down Expand Up @@ -82,7 +87,8 @@ Synchronization is automatic, that's the beauty of this plugin! It doesn't matte
The Mailjet Plugin is available in English, Spanish, French, German and Italian.
Need help? Our multilingual support team is here to answer your questions in any of these languages, any day of the week, at any time via our [online helpdesk](https://app.mailjet.com/support).

##### How to use filters to customize the subscription confirmation email template
#### Using filters ####
##### Customize the subscription confirmation email template
Add the following code to your template functions.php file. Uncomment the messages that you would like to replace.
<pre><code>
/**
Expand Down Expand Up @@ -112,7 +118,7 @@ add_filter( 'mailjet_subscription_widget_email_params', 'updateMailjetSubscripti
}
</code></pre>

##### How to use filters to replace the email confirmation template with my own file
##### Replace the email confirmation template with your own file
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -127,7 +133,7 @@ function useCustomConfirmationEmail($templatePath) {
}
</code></pre>

##### How to use filters to set your own Thank You page
##### Set your own Thank You page
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -142,7 +148,7 @@ function updateThankYouPagePath($templatePath) {
}
</code></pre>

##### How to use filters to replace the widget form file
##### Replace the widget form file
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -157,6 +163,36 @@ function useMailjetCustomWidgetFormTemplate($templatePath) {
}
</code></pre>

##### Use a template for transactinal emails
Mailjet allows you to take full advantage of the template language when using Mailjet's SMTP relay. For more info see [this guide](https://dev.mailjet.com/template-language/SMTP/). Add the following code to your template functions.php file.
<pre><code>
/**
* Use SMTP headers to send emails with a specific transactional template
* and leverage templating language to supply dynamic content to the template
*/

add_filter('wp_mail', 'my_wp_mail', 99);
function my_wp_mail($args) {
/* Provide the transac template id */
$args['headers'] .= 'X-MJ-TemplateID:123456' . "\r\n";
/* Enable templating language */
$args['headers'] .= 'X-MJ-TemplateLanguage:1' . "\r\n";
/* Send template errors to this recipient */
$args['headers'] .= 'X-MJ-TemplateErrorReporting:admin@your-site.com' . "\r\n";
/* Send data to the template. The vars must be defined in the template in order to accept data */
$args['headers'] .= 'X-MJ-Vars:' .
json_encode(
array(
"var1" => $args['subject'],
"var2" => ($recipient->first_name) ? $recipient->first_name : false,
"var3" => $args['message']
)
)
. "\r\n";
return $args;
}
</code></pre>

## For developers
Before pushing any new changes, make sure you run the following command. It will remove unneeded .git direcotries from vendors
<pre><code>
Expand All @@ -172,6 +208,10 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \;

## Changelog

##### 5.1.1
* Fixed a problem when saving the WooCommerce integration settings
* Fixed translations in the subscription confirmation email for Contact Form 7

##### 5.1.0
* New integration with Contact Form 7 has been added
* Added support for custom translation files
Expand Down
96 changes: 58 additions & 38 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
Contributors: Mailjet
Tags: email, marketing, signup, newsletter, widget, smtp, mailjet
Requires at least: 3.9
Tested up to: 5.2
Stable tag: 5.1.0
Tested up to: 5.2.1
Stable tag: 5.1.1
Requires PHP: 5.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -14,41 +15,26 @@ Use Mailjet to create, send and track beautiful and engaging marketing and trans
* The all new V5 Mailjet plugin for Wordpress has been completely redesigned and includes many new features.
* Improved plugin settings for simplified configuration
* Redesigned subscription widget for easier setup and more options - mandatory, optional or hidden form fields, custom subscription confirmation page, and more.
* Integration with WooCommerce is included - customers can subscribe to your newsletter during checkout. More integrations are coming soon.
* Integration with *Contact Form 7* - add a "Subscribe to our newsletter" checkbox to any Contact Form 7 form and easily add subscribers to your contact lists
* Integration with *WooCommerce* - customers can subscribe to your newsletter during checkout. More integrations are coming soon.
* More flexibility - use filters to set your own subscription confirmation email template or texts inside the email, set your own thank you page, or widget form.

== Description ==

Mailjet's official plugin on WordPress gives you access to:

* Easy Email Management:
Create and manage all of your marketing and transactional email campaigns directly from your WordPress admin.

* Sign Up Form & Contact Lists Management:
Create and customize contact form widgets to allow your website visitors to subscribe to your newsletters.

* Automated Contact Synchronization - 3 ways to build your contact lists:

Synchronize your WordPress contacts. The user role is added to Mailjet as a contact property, so you can filter and target marketing emails to the proper group. With ongoing synchronization, you never have to think about contact management again.

Comment authors can be added to a separate Mailjet contact list as they choose to subscribe while posting a comment on the blog.

A new cool option is to subscribe WooCommerce customers to your newsletter during checkout. Just enable the WooCommerce integration inside the plugin and you are ready to go.

* Campaign Builder Tool:
Use our drag and drop email editor or HTML builder to create beautiful and engaging emails - directly from your WordPress admin.

* World Class Deliverability:
Hit your subscribers' inboxes every time with our global deliverability and routing infrastructure

* Insight and analytics:
Access real-time statistics on your campaigns showing opens, clicks, geographies, average time to click and more to optimize your email performance.

* Data Compliance:
Mailjet is GDPR compliant and ISO 27001 certified, meaning that it guarantees an optimal level of email data privacy and security.

* International UI and Support:
Mailjet offers user interfaces, documentation and 24/7 customer support in 5 languages (English, French, German, Spanish and Italian).
* **Easy Email Management:** Create and manage all of your marketing and transactional email campaigns directly from your WordPress admin.
* **Sign Up Form & Contact Lists Management:** Create and customize contact form widgets to allow your website visitors to subscribe to your newsletters.
* **Automated Contact Synchronization** - 4 ways to build your contact lists:
* Synchronize your WordPress contacts. The user role is added to Mailjet as a contact property, so you can filter and target marketing emails to the proper group. With ongoing synchronization, you never have to think about contact management again.
* Comment authors can be added to a separate Mailjet contact list as they choose to subscribe while posting a comment on the blog.
* Subscribe WooCommerce customers to your newsletter during checkout. Just enable the WooCommerce integration inside the plugin and you are ready to go.
* Use the built in Contact Form 7 integration and allow form submitters to subscribe to your newsletter.
* **Campaign Builder Tool:** Use our drag and drop email editor or HTML builder to create beautiful and engaging emails - directly from your WordPress admin.
* **World Class Deliverability:** Hit your subscribers' inboxes every time with our global deliverability and routing infrastructure
* **Insight and analytics:** Access real-time statistics on your campaigns showing opens, clicks, geographies, average time to click and more to optimize your email performance.
* **Data Compliance:** Mailjet is GDPR compliant and ISO 27001 certified, meaning that it guarantees an optimal level of email data privacy and security.
* **International UI and Support:** Mailjet offers user interfaces, documentation and 24/7 customer support in 5 languages (English, French, German, Spanish and Italian).

== Installation ==

Expand Down Expand Up @@ -79,7 +65,7 @@ Yes. You can [create one for free](https://app.mailjet.com/signup?aff=wordpressm

= How to get started with this plugin? =
Once you have a Mailjet account, an installation Wizard will guide you through.
In case you want to use Mailjet as an SMTP relay you will need to change these parameters in your WordPress email configuration: username and password. These credentials are provided in your Mailjet Account > API Keys section [HERE](https://app.mailjet.com/account/api_keys).
In case you want to use Mailjet as an SMTP relay you will need to change these parameters in your WordPress email configuration: username and password. These credentials are provided in your Mailjet Account > [API Keys section](https://app.mailjet.com/account/api_keys).
For more help on setting up the Mailjet Plugin for WordPress, feel free to check out our [dedicated WordPress User Guide](https://www.mailjet.com/guides/wordpress-user-guide?aff=wordpressmj).

= How do I create a signup form or use the contact widget? =
Expand All @@ -92,7 +78,7 @@ Synchronization is automatic, that's the beauty of this plugin! It doesn't matte
The Mailjet Plugin is available in English, Spanish, French, German and Italian.
Need help? Our multilingual support team is here to answer your questions in any of these languages, any day of the week, at any time via our [online helpdesk](https://app.mailjet.com/support).

= How to use filters to customize the subscription confirmation email template =
= Use filters to customize the subscription confirmation email template =
Add the following code to your template functions.php file. Uncomment the messages that you would like to replace.
<pre><code>
/**
Expand Down Expand Up @@ -122,7 +108,7 @@ add_filter( 'mailjet_subscription_widget_email_params', 'updateMailjetSubscripti
}
</code></pre>

= How to use filters to replace the email confirmation template with my own file =
= Use filters to replace the email confirmation template with my own file =
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -137,7 +123,7 @@ function useCustomConfirmationEmail($templatePath) {
}
</code></pre>

= How to use filters to set your own Thank You page =
= Use filters to set your own Thank You page =
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -152,7 +138,7 @@ function updateThankYouPagePath($templatePath) {
}
</code></pre>

= How to use filters to replace the widget form file =
= Use filters to replace the widget form file =
You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.
<pre><code>
/**
Expand All @@ -167,7 +153,38 @@ function useMailjetCustomWidgetFormTemplate($templatePath) {
}
</code></pre>

= For developers - before pushing any new changes, make sure you run the following command. It will remove unneeded .git direcotries from vendors =
= Use filters to apply a template for transactinal emails =
Mailjet allows you to take full advantage of the template language when using Mailjet's SMTP relay. For more info see [this guide](https://dev.mailjet.com/template-language/SMTP/). Add the following code to your template functions.php file.

/**
* Use SMTP headers to send emails with a specific transactional template
* and leverage templating language to supply dynamic content to the template
*/
<pre><code>
add_filter('wp_mail', 'my_wp_mail', 99);
function my_wp_mail($args) {
/* Provide the transac template id */
$args['headers'] .= 'X-MJ-TemplateID:123456' . "\r\n";
/* Enable templating language */
$args['headers'] .= 'X-MJ-TemplateLanguage:1' . "\r\n";
/* Send template errors to this recipient */
$args['headers'] .= 'X-MJ-TemplateErrorReporting:admin@your-site.com' . "\r\n";
/* Send data to the template. The vars must be defined in the template in order to accept data */
$args['headers'] .= 'X-MJ-Vars:' .
json_encode(
array(
"var1" => $args['subject'],
"var2" => ($recipient->first_name) ? $recipient->first_name : false,
"var3" => $args['message']
)
)
. "\r\n";
return $args;
}
</code></pre>

= For developers =
Before pushing any new changes, make sure you run the following command. It will remove unneeded .git direcotries from vendors =
<pre><code>
find vendor/ -type d -name ".git" -exec rm -rf {} \;
</code></pre>
Expand All @@ -181,6 +198,10 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \;

== Changelog ==

= 5.1.1 =
* Fixed a problem when saving the WooCommerce integration settings
* Fixed translations in the subscription confirmation email for Contact Form 7

= 5.1 =
* New integration with Contact Form 7 has been added
* Added support for custom translation files
Expand Down Expand Up @@ -239,4 +260,3 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \;

= 5.0.1 =
* Plugin redesign and major improvements

3 changes: 1 addition & 2 deletions src/admin/js/mailjet-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
jQuery(document).ready(function ($) {

$('#copy_properties').on("click", function () {
console.log("clicked");
const text = document.querySelector('#cf7_contact_properties');
text.disabled = false;
text.select();
Expand Down Expand Up @@ -249,7 +248,7 @@ function mjCF7Subscription() {
const cf7email = document.getElementById('cf7_email');

saveButton.addEventListener("click", function (e) {
if(cf7email.value === '') {
if(activateCF7IntegrationBox.checked === true && cf7email.value === '') {
cf7email.className+= ' mj-missing-required-input';
e.preventDefault();
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/includes/Mailjet.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct()
if (defined('MAILJET_VERSION')) {
$this->version = MAILJET_VERSION;
} else {
$this->version = '5.1.0';
$this->version = '5.1.1';
}
$this->plugin_name = 'mailjet';

Expand Down
1 change: 1 addition & 0 deletions src/includes/MailjetSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function mailjet_settings_admin_init()
register_setting('mailjet_initial_contact_lists_page', 'create_contact_list_btn');
register_setting('mailjet_initial_contact_lists_page', 'create_list_name');
register_setting('mailjet_initial_contact_lists_page', 'settings_step');
register_setting('mailjet_initial_contact_lists_page', 'skip_mailjet_list');

register_setting('mailjet_connect_account_page', 'mailjet_apikey');
register_setting('mailjet_connect_account_page', 'mailjet_apisecret');
Expand Down
2 changes: 1 addition & 1 deletion src/includes/MailjetUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function updateToV5()
add_option('mailjet_activate_logger', 0);
add_option('settings_step', 'user_access_step');
add_option('api_credentials_ok', 1);
add_option('activate_mailjet_sync', 1);
add_option('activate_mailjet_sync');
add_option('activate_mailjet_initial_sync');
add_option('create_contact_list_btn');
add_option('create_list_name');
Expand Down
Loading

0 comments on commit 58ab7bc

Please sign in to comment.