MailChimp Forms by MailMunch - Version 1.0.3

Version Description

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

Files changed (3) hide show
  1. inc/sidebar_widget.php +19 -5
  2. mailchimp-mailmunch.php +16 -5
  3. readme.txt +1 -1
inc/sidebar_widget.php CHANGED
@@ -58,16 +58,27 @@ class MC_MM_Sidebar_Widget extends WP_Widget {
58
  $mc_mm_user_email = get_option("mc_mm_user_email");
59
  $mc_mm_user_password = get_option("mc_mm_user_password");
60
  if (!empty($mc_mm_user_email) && !empty($mc_mm_user_password) && !empty($mc_mm_data["site_id"])) {
61
- $mc_mm_email = get_option("mc_mm_user_email");
62
- $mc_mm_password = get_option("mc_mm_user_password");
63
  $mc_mm_site_id = $mc_mm_data["site_id"];
64
- $mm = new MailchimpMailmunchApi($mc_mm_email, $mc_mm_password, "http://".MAILCHIMP_MAILMUNCH_URL);
65
  $result = $mm->widgets($mc_mm_site_id, "Sidebar");
66
  if ( !is_wp_error( $result ) ) {
67
  $widgets = json_decode($result['body']);
68
  }
 
 
 
 
 
69
  }
70
-
 
 
 
 
 
 
 
 
71
  if (sizeof($widgets) > 0) {
72
  ?>
73
  <p>
@@ -78,6 +89,7 @@ class MC_MM_Sidebar_Widget extends WP_Widget {
78
  <p>
79
  <label for="<?php echo $this->get_field_id( 'form_id' ); ?>"><?php _e( 'Optin Form:' ); ?></label>
80
  <select class="widefat" id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>">
 
81
  <?php
82
  foreach ($widgets as $widget) {
83
  echo "<option value='".$widget->id."'";
@@ -87,10 +99,12 @@ class MC_MM_Sidebar_Widget extends WP_Widget {
87
  ?>
88
  </select>
89
  </p>
 
 
90
  <?php
91
  } else {
92
  ?>
93
- <p>No optin forms found. <a href="<?php echo admin_url( 'admin.php?page='.MAILCHIMP_MAILMUNCH_SLUG ); ?>">Create First One</a></p>
94
  <?php
95
  }
96
 
58
  $mc_mm_user_email = get_option("mc_mm_user_email");
59
  $mc_mm_user_password = get_option("mc_mm_user_password");
60
  if (!empty($mc_mm_user_email) && !empty($mc_mm_user_password) && !empty($mc_mm_data["site_id"])) {
 
 
61
  $mc_mm_site_id = $mc_mm_data["site_id"];
62
+ $mm = new MailchimpMailmunchApi($mc_mm_user_email, $mc_mm_user_password, "http://".MAILCHIMP_MAILMUNCH_URL);
63
  $result = $mm->widgets($mc_mm_site_id, "Sidebar");
64
  if ( !is_wp_error( $result ) ) {
65
  $widgets = json_decode($result['body']);
66
  }
67
+ } else {
68
+ ?>
69
+ <p>No MailMunch account found. <a href="<?php echo admin_url( 'admin.php?page='.MAILCHIMP_MAILMUNCH_SLUG ); ?>">Go Here First</a></p>
70
+ <?php
71
+ return;
72
  }
73
+ ?>
74
+ <script type="text/javascript">
75
+ window.onmessage = function (e) {
76
+ if (e.data === 'refresh') {
77
+ top.location.reload();
78
+ }
79
+ };
80
+ </script>
81
+ <?php
82
  if (sizeof($widgets) > 0) {
83
  ?>
84
  <p>
89
  <p>
90
  <label for="<?php echo $this->get_field_id( 'form_id' ); ?>"><?php _e( 'Optin Form:' ); ?></label>
91
  <select class="widefat" id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>">
92
+ <option value="">None</option>
93
  <?php
94
  foreach ($widgets as $widget) {
95
  echo "<option value='".$widget->id."'";
99
  ?>
100
  </select>
101
  </p>
102
+
103
+ <p><a href="//<?php echo MAILCHIMP_MAILMUNCH_URL ?>/sso?email=<?php echo $mc_mm_user_email ?>&password=<?php echo $mc_mm_user_password ?>&next_url=<?php echo urlencode("/sites/".$mc_mm_data["site_id"]."/widgets/new?wp_layout=1&widget_type=Sidebar") ?>" target="_blank">Create New Sidebar Form</a></p>
104
  <?php
105
  } else {
106
  ?>
107
+ <p>No sidebar forms found. <a href="//<?php echo MAILCHIMP_MAILMUNCH_URL ?>/sso?email=<?php echo $mc_mm_user_email ?>&password=<?php echo $mc_mm_user_password ?>&next_url=<?php echo urlencode("/sites/".$mc_mm_data["site_id"]."/widgets/new?wp_layout=1&widget_type=Sidebar") ?>" target="_blank">Create Your First One</a></p>
108
  <?php
109
  }
110
 
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.2
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.2");
18
  define( 'MAILCHIMP_MAILMUNCH_URL', "www.mailmunch.co");
19
 
20
  // Create unique WordPress instance ID
@@ -26,11 +26,22 @@
26
  add_action( 'admin_menu', 'mc_mm_register_page' );
27
 
28
  function mc_mm_register_page(){
29
- $menu_page = add_menu_page( 'MailChimp Settings', 'MailChimp', 'manage_options', MAILCHIMP_MAILMUNCH_SLUG, 'mc_mm_setup', plugins_url( 'img/icon.png', __FILE__ ), 103.786 );
30
- // If successful, load admin assets only on that page.
31
- if ($menu_page) add_action('load-' . $menu_page, 'mc_mm_load_plugin_assets');
 
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
34
  function mc_mm_load_plugin_assets() {
35
  add_action( 'admin_enqueue_scripts', 'mc_mm_enqueue_admin_styles' );
36
  add_action( 'admin_enqueue_scripts', 'mc_mm_enqueue_admin_scripts' );
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
  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
26
  add_action( 'admin_menu', 'mc_mm_register_page' );
27
 
28
  function mc_mm_register_page(){
29
+ add_options_page('MailChimp', 'MailChimp', 'manage_options', MAILCHIMP_MAILMUNCH_SLUG, 'mc_mm_setup');
30
+ $menu_page = add_menu_page( 'MailChimp Settings', 'MailChimp', 'manage_options', MAILCHIMP_MAILMUNCH_SLUG, 'mc_mm_setup', plugins_url( 'img/icon.png', __FILE__ ), 103.786 );
31
+ // If successful, load admin assets only on that page.
32
+ if ($menu_page) add_action('load-' . $menu_page, 'mc_mm_load_plugin_assets');
33
  }
34
 
35
+ function mc_mm_plugin_settings_link($links)
36
+ {
37
+ $settings_link = '<a href="options-general.php?page='.MAILCHIMP_MAILMUNCH_SLUG.'">Settings</a>';
38
+ array_unshift($links, $settings_link);
39
+ return $links;
40
+ }
41
+
42
+ $plugin = plugin_basename(__FILE__);
43
+ add_filter('plugin_action_links_'.$plugin, 'mc_mm_plugin_settings_link');
44
+
45
  function mc_mm_load_plugin_assets() {
46
  add_action( 'admin_enqueue_scripts', 'mc_mm_enqueue_admin_styles' );
47
  add_action( 'admin_enqueue_scripts', 'mc_mm_enqueue_admin_scripts' );
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.2
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.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9