MailMunch – Grow your Email List - Version 1.3.4

Version Description

  • Fixed plugin activation bug
Download this release

Release Info

Developer mailmunch
Plugin Icon 128x128 MailMunch – Grow your Email List
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

Files changed (5) hide show
  1. css/admin.css +14 -1
  2. inc/common.php +7 -3
  3. js/admin.js +11 -1
  4. mailmunch.php +112 -17
  5. readme.txt +4 -1
css/admin.css CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #mailmunch_frame {
2
  width: 720px;
3
  height: 650px;
@@ -181,7 +194,7 @@ output {
181
  }
182
  .form-control {
183
  display: block;
184
- width: 100%;
185
  height: 34px;
186
  padding: 6px 12px;
187
  font-size: 14px;
1
+ #sign-in-form, #sign-up-form {
2
+ display: none;
3
+ }
4
+
5
+ #sign-in-form.active, #sign-up-form.active {
6
+ display: block;
7
+ }
8
+
9
+ #show-sign-in, #show-sign-up {
10
+ cursor: pointer;
11
+ text-decoration: underline;
12
+ }
13
+
14
  #mailmunch_frame {
15
  width: 720px;
16
  height: 650px;
194
  }
195
  .form-control {
196
  display: block;
197
+ width: 400px;
198
  height: 34px;
199
  padding: 6px 12px;
200
  font-size: 14px;
inc/common.php CHANGED
@@ -4,14 +4,18 @@ function getEmailPassword() {
4
  $mailmunch_email = get_option("mailmunch_user_email");
5
  $mailmunch_password = get_option("mailmunch_user_password");
6
 
7
- if (empty($mailmunch_email) || empty($mailmunch_password)) {
8
  $current_user = wp_get_current_user();
9
  update_option("mailmunch_user_email", $current_user->user_email);
 
 
 
10
  update_option("mailmunch_user_password", uniqid());
11
- $mailmunch_email = get_option("mailmunch_user_email");
12
- $mailmunch_password = get_option("mailmunch_user_password");
13
  }
14
 
 
 
 
15
  return array('email' => $mailmunch_email, 'password' => $mailmunch_password);
16
  }
17
 
4
  $mailmunch_email = get_option("mailmunch_user_email");
5
  $mailmunch_password = get_option("mailmunch_user_password");
6
 
7
+ if (empty($mailmunch_email)) {
8
  $current_user = wp_get_current_user();
9
  update_option("mailmunch_user_email", $current_user->user_email);
10
+ }
11
+
12
+ if (empty($mailmunch_password)) {
13
  update_option("mailmunch_user_password", uniqid());
 
 
14
  }
15
 
16
+ $mailmunch_email = get_option("mailmunch_user_email");
17
+ $mailmunch_password = get_option("mailmunch_user_password");
18
+
19
  return array('email' => $mailmunch_email, 'password' => $mailmunch_password);
20
  }
21
 
js/admin.js CHANGED
@@ -23,4 +23,14 @@ window.onmessage = function (e) {
23
  if (e.data === 'refresh') {
24
  top.location.reload();
25
  }
26
- };
 
 
 
 
 
 
 
 
 
 
23
  if (e.data === 'refresh') {
24
  top.location.reload();
25
  }
26
+ };
27
+
28
+ function showSignInForm() {
29
+ document.getElementById("sign-up-form").style.display = 'none';
30
+ document.getElementById("sign-in-form").style.display = 'block';
31
+ }
32
+
33
+ function showSignUpForm() {
34
+ document.getElementById("sign-in-form").style.display = 'none';
35
+ document.getElementById("sign-up-form").style.display = 'block';
36
+ }
mailmunch.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailMunch
4
  Plugin URI: http://www.mailmunch.co
5
  Description: Collect email addresses from website visitors and grow your subscribers with our attention grabbing optin-forms, entry/exit intent technology, and other effective lead-generation forms.
6
- Version: 1.3.3
7
  Author: MailMunch
8
  Author URI: http://www.mailmunch.co
9
  License: GPL2
@@ -13,7 +13,7 @@
13
  require_once( plugin_dir_path( __FILE__ ) . 'inc/common.php' );
14
 
15
  define( 'MAILMUNCH_SLUG', "mailmunch");
16
- define( 'MAILMUNCH_VER', "1.3.3");
17
  define( 'MAILMUNCH_URL', "www.mailmunch.co");
18
 
19
  // Adding Admin Menu
@@ -83,8 +83,6 @@
83
 
84
  function add_post_containers($content) {
85
  if (is_single() || is_page()) {
86
- //$content = insert_form_after_paragraph("<div class='mailmunch-forms-after-paragraph-one' style='display: none !important;'></div>", 1, $content);
87
- //$content = insert_form_after_paragraph("<div class='mailmunch-forms-after-paragraph-two' style='display: none !important;'></div>", 2, $content);
88
  $content = insert_form_after_paragraph("<div class='mailmunch-forms-in-post-middle' style='display: none !important;'></div>", "middle", $content);
89
  $content = "<div class='mailmunch-forms-before-post' style='display: none !important;'></div>" . $content . "<div class='mailmunch-forms-after-post' style='display: none !important;'></div>";
90
  }
@@ -134,13 +132,39 @@
134
 
135
  $mailmunch_data = array_merge(unserialize(get_option('mailmunch_data')), $post_data);
136
  update_option("mailmunch_data", serialize($mailmunch_data));
 
137
  } else if ($post_action == "sign_in") {
 
138
  $mm = new MailmunchApi($_POST["email"], $_POST["password"], "http://".MAILMUNCH_URL);
139
  if ($mm->validPassword()) {
140
  update_option("mailmunch_user_email", $_POST["email"]);
141
  update_option("mailmunch_user_password", $_POST["password"]);
142
  }
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  } else if ($post_action == "unlink_account") {
145
 
146
  $mailmunch_data = array();
@@ -163,48 +187,119 @@
163
  }
164
  }
165
 
166
- $account_info = getEmailPassword();
167
- $mailmunch_email = $account_info['email'];
168
- $mailmunch_password = $account_info['password'];
 
 
 
169
 
170
- $mm = new MailmunchApi($mailmunch_email, $mailmunch_password, "http://".MAILMUNCH_URL);
171
- if ($mm->isNewUser()) {
172
- $mm->signUp();
173
- } else if (!$mm->validPassword()) {
 
 
 
174
  ?>
175
- <div class="container">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  <div class="page-header">
177
  <h1>Sign In</h1>
178
  </div>
179
 
180
- <p>You may already have a MailMunch account. Sign in using your email and password below.</p>
181
 
182
  <?php if ($_POST && $_POST["action"] == "sign_in") { ?>
183
  <div id="invalid-alert" class="alert alert-danger" role="alert">Invalid Email or Password. Please try again.</div>
184
  <?php } ?>
185
 
186
- <div id="sign-in-form" class="form-container">
187
  <form action="" method="POST">
188
  <input type="hidden" name="action" value="sign_in" />
189
 
190
  <div class="form-group">
191
  <label>Email Address</label>
192
- <input type="email" placeholder="Email Address" name="email" class="form-control">
193
  </div>
194
  <div class="form-group">
195
  <label>Password</label>
196
- <input type="password" placeholder="Password" name="password" class="form-control">
197
  </div>
198
 
199
  <div class="form-group">
200
- <input type="submit" value="Sign In" class="btn btn-success btn-lg" />
201
  </div>
202
  </form>
203
  </div>
204
 
205
  <p>Forgot your password? <a href="http://<?php echo MAILMUNCH_URL; ?>/users/password/new" target="_blank">Click here</a> to retrieve it.</p>
 
206
  </div>
207
  <?php
 
 
208
  return;
209
  }
210
 
3
  Plugin Name: MailMunch
4
  Plugin URI: http://www.mailmunch.co
5
  Description: Collect email addresses from website visitors and grow your subscribers with our attention grabbing optin-forms, entry/exit intent technology, and other effective lead-generation forms.
6
+ Version: 1.3.4
7
  Author: MailMunch
8
  Author URI: http://www.mailmunch.co
9
  License: GPL2
13
  require_once( plugin_dir_path( __FILE__ ) . 'inc/common.php' );
14
 
15
  define( 'MAILMUNCH_SLUG', "mailmunch");
16
+ define( 'MAILMUNCH_VER', "1.3.4");
17
  define( 'MAILMUNCH_URL', "www.mailmunch.co");
18
 
19
  // Adding Admin Menu
83
 
84
  function add_post_containers($content) {
85
  if (is_single() || is_page()) {
 
 
86
  $content = insert_form_after_paragraph("<div class='mailmunch-forms-in-post-middle' style='display: none !important;'></div>", "middle", $content);
87
  $content = "<div class='mailmunch-forms-before-post' style='display: none !important;'></div>" . $content . "<div class='mailmunch-forms-after-post' style='display: none !important;'></div>";
88
  }
132
 
133
  $mailmunch_data = array_merge(unserialize(get_option('mailmunch_data')), $post_data);
134
  update_option("mailmunch_data", serialize($mailmunch_data));
135
+
136
  } else if ($post_action == "sign_in") {
137
+
138
  $mm = new MailmunchApi($_POST["email"], $_POST["password"], "http://".MAILMUNCH_URL);
139
  if ($mm->validPassword()) {
140
  update_option("mailmunch_user_email", $_POST["email"]);
141
  update_option("mailmunch_user_password", $_POST["password"]);
142
  }
143
 
144
+ } else if ($post_action == "sign_up") {
145
+
146
+ if (empty($_POST["email"]) || empty($_POST["password"])) {
147
+ $invalid_email_password = true;
148
+ } else {
149
+ update_option("mailmunch_user_email", $_POST["email"]);
150
+ update_option("mailmunch_user_password", $_POST["password"]);
151
+ $mailmunch_data = unserialize(get_option("mailmunch_data"));
152
+ $mailmunch_data["site_url"] = $_POST["site_url"];
153
+ $mailmunch_data["site_name"] = $_POST["site_name"];
154
+ update_option("mailmunch_data", serialize($mailmunch_data));
155
+
156
+ $account_info = getEmailPassword();
157
+ $mailmunch_email = $account_info['email'];
158
+ $mailmunch_password = $account_info['password'];
159
+
160
+ $mm = new MailmunchApi($mailmunch_email, $mailmunch_password, "http://".MAILMUNCH_URL);
161
+ if ($mm->isNewUser()) {
162
+ $mm->signUp();
163
+ } else {
164
+ $user_exists = true;
165
+ }
166
+ }
167
+
168
  } else if ($post_action == "unlink_account") {
169
 
170
  $mailmunch_data = array();
187
  }
188
  }
189
 
190
+ // If we already have the user's email stored, let's create the API instance
191
+ // If we don't have it yet, make sure NOT to phone home any user data
192
+ if (get_option("mailmunch_user_email") != "") {
193
+ $account_info = getEmailPassword();
194
+ $mailmunch_email = $account_info['email'];
195
+ $mailmunch_password = $account_info['password'];
196
 
197
+ $mm = new MailmunchApi($mailmunch_email, $mailmunch_password, "http://".MAILMUNCH_URL);
198
+ $valid_password = $mm->validPassword();
199
+ }
200
+
201
+ // If we don't already have the user's email, show the sign up / sign in form to the user
202
+ if (get_option("mailmunch_user_email") == "" || !$valid_password || $invalid_email_password) {
203
+ $current_user = wp_get_current_user();
204
  ?>
205
+ <div id="sign-up-form" class="container<?php if (!$_POST || ($_POST["action"] != "sign_in" && $_POST["action"] != "unlink_account")) { ?> active<?php } ?>">
206
+ <div class="page-header">
207
+ <h1>Create Account</h1>
208
+ </div>
209
+
210
+ <?php add_thickbox(); ?>
211
+
212
+ <div id="why-account" style="display:none;">
213
+ <p>
214
+ There are a few reasons we require you to create an account to use MailMunch:
215
+ </p>
216
+
217
+ <ol>
218
+ <li>MailMunch is a not just a Wordpress plugin but also a standalone service. You can later use the same account on your other non-Wordpress websites too.</li>
219
+ <li>Creating an account helps us better serve you, and provide you with better customer support.</li>
220
+ <li>It gives us the ability to fix bugs and improve performance faster, and without you having to update the plugin yourself.</li>
221
+ </ol>
222
+
223
+ <p><strong>We have a strict no-spam policy. We will never spam you or share your information with any third-party.</strong> If you have any questions, please <a href="http://www.mailmunch.co/contact" target="_blank">contact us</a>.</p>
224
+ </div>
225
+
226
+ <p>We will now create your account on MailMunch (<a href="#TB_inline?width=500&height=250&inlineId=why-account" title="Why do I need an account to use the MailMunch plugin?" class="thickbox">Why?</a>). Make sure the following information is correct:</p>
227
+
228
+ <?php if ($user_exists) { ?>
229
+ <div id="invalid-alert" class="alert alert-danger" role="alert">Account with this email already exists. Please sign in using your password.</div>
230
+ <?php } else if ($invalid_email_password) { ?>
231
+ <div id="invalid-alert" class="alert alert-danger" role="alert">Invalid email or password. Please enter valid information below.</div>
232
+ <?php } ?>
233
+
234
+ <div class="form-container">
235
+ <form action="" method="POST">
236
+ <input type="hidden" name="action" value="sign_up" />
237
+
238
+ <div class="form-group">
239
+ <label>Wordpress Name</label>
240
+ <input type="text" placeholder="Site Name" name="site_name" value="<?php echo $mailmunch_data["site_name"] ?>" class="form-control">
241
+ </div>
242
+
243
+ <div class="form-group">
244
+ <label>Wordpress URL</label>
245
+ <input type="text" placeholder="Site URL" name="site_url" value="<?php echo $mailmunch_data["site_url"] ?>" class="form-control">
246
+ </div>
247
+
248
+ <div class="form-group">
249
+ <label>Email Address</label>
250
+ <input type="email" placeholder="Email Address" name="email" value="<?php echo $current_user->user_email ?>" class="form-control">
251
+ </div>
252
+
253
+ <div class="form-group">
254
+ <label>Password</label>
255
+ <input type="password" placeholder="Password" name="password" class="form-control">
256
+ </div>
257
+
258
+ <div class="form-group">
259
+ <input type="submit" value="Sign Up &raquo;" class="btn btn-success btn-lg" />
260
+ </div>
261
+ </form>
262
+ </div>
263
+
264
+ <p>Already have an account? <a id="show-sign-in" onclick="showSignInForm();">Sign In</a></p>
265
+ </div>
266
+
267
+ <div id="sign-in-form" class="container<?php if ($_POST && ($_POST["action"] == "sign_in" || $_POST["action"] == "unlink_account")) { ?> active<?php } ?>">
268
  <div class="page-header">
269
  <h1>Sign In</h1>
270
  </div>
271
 
272
+ <p>Sign in using your email and password below.</p>
273
 
274
  <?php if ($_POST && $_POST["action"] == "sign_in") { ?>
275
  <div id="invalid-alert" class="alert alert-danger" role="alert">Invalid Email or Password. Please try again.</div>
276
  <?php } ?>
277
 
278
+ <div class="form-container">
279
  <form action="" method="POST">
280
  <input type="hidden" name="action" value="sign_in" />
281
 
282
  <div class="form-group">
283
  <label>Email Address</label>
284
+ <input type="email" placeholder="Email Address" name="email" class="form-control" value="<?php echo $_POST["email"] ?>" />
285
  </div>
286
  <div class="form-group">
287
  <label>Password</label>
288
+ <input type="password" placeholder="Password" name="password" class="form-control" />
289
  </div>
290
 
291
  <div class="form-group">
292
+ <input type="submit" value="Sign In &raquo;" class="btn btn-success btn-lg" />
293
  </div>
294
  </form>
295
  </div>
296
 
297
  <p>Forgot your password? <a href="http://<?php echo MAILMUNCH_URL; ?>/users/password/new" target="_blank">Click here</a> to retrieve it.</p>
298
+ <p>Don't have an account? <a id="show-sign-up" onclick="showSignUpForm();">Sign Up</a></p>
299
  </div>
300
  <?php
301
+
302
+ // Do NOT move beyond this until the user has granted permissions to sign up or signed in
303
  return;
304
  }
305
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mailmunch
3
  Tags: widget, MailChimp, newsletter, newsletters, MailChimp plugin, Aweber,subscribe, popup, exit popup, exit intent, growth, subscribers, subscription, hellobar, email, posts, sharing, links, popover, analytics , newsletter, automatic , mail, lightbox, analytics, newsletter, getresponse, collect email, optin, optin forms, double optin, popover, optin monster, popup domination, sumome, list builder, mailchimp, popupdomination, optin revolution
4
  Requires at least: 3.0.1
5
  Tested up to: 4.0
6
- Stable tag: 1.3.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -131,6 +131,9 @@ Why people use Aweber
131
 
132
  == Changelog ==
133
 
 
 
 
134
  = 1.3.3 =
135
  * Added short-code support for embedded optin forms
136
 
3
  Tags: widget, MailChimp, newsletter, newsletters, MailChimp plugin, Aweber,subscribe, popup, exit popup, exit intent, growth, subscribers, subscription, hellobar, email, posts, sharing, links, popover, analytics , newsletter, automatic , mail, lightbox, analytics, newsletter, getresponse, collect email, optin, optin forms, double optin, popover, optin monster, popup domination, sumome, list builder, mailchimp, popupdomination, optin revolution
4
  Requires at least: 3.0.1
5
  Tested up to: 4.0
6
+ Stable tag: 1.3.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
131
 
132
  == Changelog ==
133
 
134
+ = 1.3.4 =
135
+ * Fixed plugin activation bug
136
+
137
  = 1.3.3 =
138
  * Added short-code support for embedded optin forms
139