MailChimp Forms by MailMunch - Version 1.0.4

Version Description

Download this release

Release Info

Developer mailmunch
Plugin Icon 128x128 MailChimp Forms by MailMunch
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

Files changed (3) hide show
  1. inc/mailmunchapi.php +16 -8
  2. mailchimp-mailmunch.php +10 -3
  3. readme.txt +1 -1
inc/mailmunchapi.php CHANGED
@@ -117,15 +117,18 @@
117
  }
118
 
119
  function validPassword() {
120
- $this->requestType = 'get';
121
- $request = $this->ping('/sites');
 
 
 
122
 
123
- if ($request['response']['code'] == 200){
124
- return true;
125
- }
126
- else {
127
- return false;
128
- }
129
  }
130
 
131
  function isNewUser($email) {
@@ -156,6 +159,11 @@
156
  $args = array_merge($args, array('method' => 'POST', 'body' => $options));
157
  $request = wp_remote_post($url, $args);
158
  }
 
 
 
 
 
159
  return $request;
160
  }
161
  }
117
  }
118
 
119
  function validPassword() {
120
+ $this->requestType = 'get';
121
+ $request = $this->ping('/sites');
122
+ if( is_wp_error( $request ) ) {
123
+ return new WP_Error( 'broke', "Unable to connect to MailMunch. Please try again later." );
124
+ }
125
 
126
+ if ($request['response']['code'] == 200){
127
+ return true;
128
+ }
129
+ else {
130
+ return false;
131
+ }
132
  }
133
 
134
  function isNewUser($email) {
159
  $args = array_merge($args, array('method' => 'POST', 'body' => $options));
160
  $request = wp_remote_post($url, $args);
161
  }
162
+
163
+ if ( !is_wp_error( $request ) && $request['response']['code'] == 500 ) {
164
+ return new WP_Error( 'broke', "Internal Server Error" );
165
+ }
166
+
167
  return $request;
168
  }
169
  }
mailchimp-mailmunch.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailChimp Forms by MailMunch
4
  Plugin URI: http://connect.mailchimp.com/integrations/mailmunch-email-list-builder
5
  Description: The MailChimp plugin allows you to quickly and easily add signup forms for your MailChimp lists. Popup, Embedded, Top Bar and a variety of different options available.
6
- Version: 1.0.3
7
  Author: MailMunch
8
  Author URI: http://www.mailmunch.co
9
  License: GPL2
@@ -14,7 +14,7 @@
14
  require_once( plugin_dir_path( __FILE__ ) . 'inc/sidebar_widget.php' );
15
 
16
  define( 'MAILCHIMP_MAILMUNCH_SLUG', "mailchimp-mailmunch");
17
- define( 'MAILCHIMP_MAILMUNCH_VER', "1.0.3");
18
  define( 'MAILCHIMP_MAILMUNCH_URL', "www.mailmunch.co");
19
 
20
  // Create unique WordPress instance ID
@@ -247,7 +247,14 @@
247
  $mc_mm_password = $account_info['password'];
248
 
249
  $mm = new MailchimpMailmunchApi($mc_mm_email, $mc_mm_password, "http://".MAILCHIMP_MAILMUNCH_URL);
250
- if (!$mm->validPassword()) {
 
 
 
 
 
 
 
251
  // Invalid user, create a GUEST user
252
  $mc_mm_email = "guest_".uniqid()."@mailmunch.co";
253
  $mc_mm_password = uniqid();
3
  Plugin Name: MailChimp Forms by MailMunch
4
  Plugin URI: http://connect.mailchimp.com/integrations/mailmunch-email-list-builder
5
  Description: The MailChimp plugin allows you to quickly and easily add signup forms for your MailChimp lists. Popup, Embedded, Top Bar and a variety of different options available.
6
+ Version: 1.0.4
7
  Author: MailMunch
8
  Author URI: http://www.mailmunch.co
9
  License: GPL2
14
  require_once( plugin_dir_path( __FILE__ ) . 'inc/sidebar_widget.php' );
15
 
16
  define( 'MAILCHIMP_MAILMUNCH_SLUG', "mailchimp-mailmunch");
17
+ define( 'MAILCHIMP_MAILMUNCH_VER', "1.0.4");
18
  define( 'MAILCHIMP_MAILMUNCH_URL', "www.mailmunch.co");
19
 
20
  // Create unique WordPress instance ID
247
  $mc_mm_password = $account_info['password'];
248
 
249
  $mm = new MailchimpMailmunchApi($mc_mm_email, $mc_mm_password, "http://".MAILCHIMP_MAILMUNCH_URL);
250
+ $pass_check = $mm->validPassword();
251
+
252
+ if( is_wp_error( $pass_check ) ) {
253
+ echo $pass_check->get_error_message();
254
+ return;
255
+ }
256
+
257
+ if (!$pass_check) {
258
  // Invalid user, create a GUEST user
259
  $mc_mm_email = "guest_".uniqid()."@mailmunch.co";
260
  $mc_mm_password = uniqid();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mailmunch
3
  Tags: mailchimp, MailChimp form, MailChimp Newsletter form, MailChimp plugin, newsletter, newsletter form, newsletter form plugin, optin form, form, signup, signup forms, signup form, widget, email form, leads
4
  Requires at least: 3.0.1
5
  Tested up to: 4.0
6
- Stable tag: 1.0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
3
  Tags: mailchimp, MailChimp form, MailChimp Newsletter form, MailChimp plugin, newsletter, newsletter form, newsletter form plugin, optin form, form, signup, signup forms, signup form, widget, email form, leads
4
  Requires at least: 3.0.1
5
  Tested up to: 4.0
6
+ Stable tag: 1.0.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9