Changeset 1391118
- Timestamp:
- 04/10/2016 12:23:13 AM (10 years ago)
- Location:
- simple-constant-contact
- Files:
-
- 6 added
- 2 edited
-
assets/icon-128x128.jpg (added)
-
assets/icon-256x256.jpg (added)
-
assets/screenshot-1.jpg (added)
-
assets/screenshot-2.jpg (added)
-
trunk/js (added)
-
trunk/js/simpleCC.js (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/simple_constant_contact.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-constant-contact/trunk/readme.txt
r1006963 r1391118 1 1 === Simple Constant Contact === 2 Contributors: ashtonpaul 3 Link: http:// www.ashtonpaul.com/simplecc4 Donate link: http:// www.ashtonpaul.com/simplecc2 Contributors: ashtonpaul, elementsweb 3 Link: http://simplecc.ashtonpaul.com/ 4 Donate link: http://simplecc.ashtonpaul.com/ 5 5 Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up 6 6 Requires at least: 3.8 7 Tested up to: 4. 07 Tested up to: 4.4.2 8 8 Stable tag: trunk 9 9 License: GPLv2 or later … … 17 17 == Installation == 18 18 1. Install Simple Constant Contact either via the WordPress.org plugin directory, or by uploading the files to your server 19 2. After activating Simple Constant Contact, navigate to the menu item 'Simple Constant Contact'.20 3. Click the 'Get Access Token' Button. Then login to your Constant Con atct account and authorize the plugin.21 4. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's wordpress options page.22 5. Enter a List name you want the email addresses to group under in your Constant Con act account (default is Simple Constant Contact).23 6. Use the short code [simpleCC] to display the form.19 2. After activating Simple Constant Contact, navigate to the options menu item 'Simple Constant Contact'. 20 3. Click the 'Get Access Token' Button. Then login to your Constant Contact account and authorize the plugin. 21 4. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's WordPress options page. 22 5. Enter a List name you want the email addresses to group under in your Constant Contact account (default is Simple Constant Contact). 23 6. Use the short-code [simpleCC] to display the form. 24 24 7. If you like you can leave the formatting as is or create your own stylesheets to match your theme. 25 25 … … 29 29 30 30 ` 31 <div class="simpleCC_plugin"> 32 <form class="simpleCC_form" id="simpleCC_form" method="post"> 33 <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label> 34 <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label> 35 <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label> 31 <div class="simpleCC_plugin"> 32 <p id="simpleCC_error_message"></p> 33 <form name="simpleCC_form" class="simpleCC_form" id="simpleCC_form" method="post" onsubmit="return simpleCC_message()"> 34 <label for="simpleCC_fname"> 35 First Name 36 <input type="text" id="simpleCC_fname" name="simpleCC_fname" /> 37 </label> 38 <label for="simpleCC_lname"> 39 Last Name 40 <input type="text" id="simpleCC_lname" name="simpleCC_lname" /> 41 </label> 42 <label for="simpleCC_email"> 43 Email 44 <input type="email" id="simpleCC_email" name="simpleCC_email" /> 45 </label> 46 <input type="hidden" name="simpleCC_submitted" id="simpleCC_submitted" value="" /> 36 47 <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button> 37 48 </form> 38 49 </div> 39 50 ` 51 == Screenshots == 52 1. This is how it looks with a little big of formatting via CSS 53 2. Settings page 54 40 55 41 56 == Changelog == 42 57 = 1.0 = 43 * initial release 44 === Simple Constant Contact === 45 Contributors: ashtonpaul 46 Link: http://www.ashtonpaul.com/simplecc 47 Donate link: http://www.ashtonpaul.com/simplecc 48 Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up 49 Requires at least: 3.8 50 Tested up to: 4.0 51 Stable tag: trunk 52 License: GPLv2 or later 53 License URI: http://www.gnu.org/licenses/gpl-2.0.html 54 55 Simple Wordpress Constant Contact Plugin to take name and email and allow to send that information straight to Constant Contact 56 57 == Description == 58 The Simple Constant Contact Plugin is a quick and easy plugin to interface with your constant contact account. It takes the visitor's name and email and allows it to send that information directly to your Constant Contact account. Set up is easy. Just follow the instructions in the admin menu and you're on your way. The UI was left raw with class and id tags so you can apply your own styling to match your current theme. 59 60 == Installation == 61 1. Install Simple Constant Contact either via the WordPress.org plugin directory, or by uploading the files to your server 62 2. After activating Simple Constant Contact, navigate to the menu item 'Simple Constant Contact'. 63 3. Click the 'Get Access Token' Button. Then login to your Constant Conatct account and authorize the plugin. 64 4. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's wordpress options page. 65 5. Enter a List name you want the email addresses to group under in your Constant Conact account (default is Simple Constant Contact). 66 6. Use the shortcode [SimpleCC] to display the form. 67 7. If you like you can leave the formatting as is or create your own stylesheets to match your theme. 68 69 == Frequently Asked Questions == 70 71 = What is the HTML output so I can match my theme style? = 72 73 ` 74 <div class="simpleCC_plugin"> 75 <form class="simpleCC_form" id="simpleCC_form" method="post"> 76 <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label> 77 <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label> 78 <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label> 79 <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button> 80 </form> 81 </div> 82 ` 83 84 == Changelog == 85 = 1.0 = 86 * initial release 58 * Initial release 59 = 1.1 = 60 * Update documentation to include usage on settings page 61 * Update redirect URI to subdomain 62 * Move settings page under options instead of main menu 63 * Add capability for custom success message 64 * Error handling on forms 65 * Success message on submit 66 * Fixed return bug for short-code (Thanks to elementsweb) 67 * Update readme file 68 * Added logo 69 * Added screenshot -
simple-constant-contact/trunk/simple_constant_contact.php
r991579 r1391118 2 2 /** 3 3 * Plugin Name: Simple Constant Contact 4 * Plugin URI: http:// ashtonpaul.com/projects/simple_constant_contact4 * Plugin URI: http://www.ashtonpaul.com/project/simple-constant-contact/ 5 5 * Description: Simple Wordpress Newsletter Plugin to take name and email. 6 * Version: 1. 06 * Version: 1.1 7 7 * Author: Ashton Paul 8 * Author URI: http://ashtonpaul.com/simplecc/ 8 * Author URI: http://ashtonpaul.com/ 9 * Contributors: elementsweb 9 10 * Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up, sign up 10 11 * License: GPL2 11 12 * 12 * Copyright (C) 201 4 Ashton Paul (email[email protected])13 * Copyright (C) 2016 Ashton Paul (email: [email protected]) 13 14 * 14 15 * This program is free software; you can redistribute it and/or … … 53 54 // debug variable to trigger html responses 54 55 public $enabled = false; 55 public $error = false; 56 public $error = false; 56 57 57 58 // instance variable to help with memory management … … 103 104 // create a new connection to the constant contact by API and see if every thing is ready to go 104 105 private function ready(){ 105 // define constant ontact APIKEY and ACCESS_TOKEN and the contact list to be used106 // define constant contact APIKEY and ACCESS_TOKEN and the contact list to be used 106 107 if (!defined("APIKEY")) define("APIKEY", get_option('simpleCC_apikey')); 107 108 if (!defined("ACCESS_TOKEN")) define("ACCESS_TOKEN", get_option('simpleCC_accesstoken')); 108 if (!defined("WEBSITE_LIST")) define("WEBSITE_LIST", get_option('simpleCC_listname') ? get_option('simpleCC_listname') : 'Simple Constant Contact'); 109 if (!defined("WEBSITE_LIST")) { 110 if (get_option('simpleCC_listname')) { 111 define("WEBSITE_LIST", get_option('simpleCC_listname')); 112 } 113 else { 114 define("WEBSITE_LIST", 'Simple Constant Contact'); 115 } 116 } 117 118 if (!defined("SUCCESS_MESSAGE")) { 119 if (get_option('simpleCC_message_successful')) { 120 define("SUCCESS_MESSAGE", get_option('simpleCC_message_successful')); 121 } 122 else { 123 define("SUCCESS_MESSAGE", 'Thanks for subscribing!'); 124 } 125 } 126 109 127 110 128 try { 111 112 129 // instantiate new API reference variable 113 130 $this->cc = new ConstantContact(APIKEY); … … 119 136 } 120 137 catch (CtctException $ex) { 138 echo 'Simple Constant Contact is not authenticated. Get a new Access Code.'; 121 139 $this->enabled = false; 122 140 } … … 127 145 } 128 146 catch (CtctException $ex) { 129 echo "Simple Constant Contact is not configured properly."; 130 return false; 147 echo 'Simple Constant Contact is not configured properly.'; 148 $this->enabled = false; 149 return $this->enabled; 131 150 } 132 151 } … … 139 158 delete_option('simpleCC_accesstoken'); 140 159 delete_option('simpleCC_listname'); 160 delete_option('simpleCC_message_successful'); 161 delete_option('simpleCC_redirect'); 141 162 142 163 // unregister it from options and options group … … 145 166 unregister_setting('simpleCC_options','simpleCC_accesstoken'); 146 167 unregister_setting('simpleCC_options','simpleCC_listname'); 168 unregister_setting('simpleCC_options','simpleCC_message_successful'); 147 169 unregister_setting('simpleCC_options','simpleCC_redirect'); 148 170 } … … 155 177 register_setting('simpleCC_options','simpleCC_accesstoken'); 156 178 register_setting('simpleCC_options','simpleCC_listname'); 179 register_setting('simpleCC_options','simpleCC_message_successful'); 157 180 register_setting('simpleCC_options','simpleCC_redirect'); 158 181 … … 160 183 update_option('simpleCC_apikey','f7mpubkv2na59zpu5juuyfq3'); 161 184 update_option('simpleCC_secret','GcgS2p6TDvwRJnxZtfag2tFp'); 162 update_option('simpleCC_redirect','http:// ashtonpaul.com/simplecc/');185 update_option('simpleCC_redirect','http://simplecc.ashtonpaul.com/'); 163 186 164 187 // hook to remove all settings made on deactivation … … 182 205 if (is_email($email) && !empty($first_name) && !empty($last_name)) { 183 206 $result = $this->contactEntry($first_name, $last_name, $email); 207 $submitted = true; 184 208 } 185 209 } … … 189 213 function simpleCC_option_page() 190 214 { 191 // indicated that the options have been updated192 if (isset($_GET['settings-updated'])) {193 echo '<div id="setting-error-settings_updated" class="updated settings-error">';194 echo '<p><strong>Settings saved</strong></p></div>';195 }196 197 215 ?> 198 216 <!-- display form in admin menu --> 199 217 <div class="wrap"> 200 <h2>Simple Constant Contact Options Page</h2>218 <h2>Simple Constant Contact Settings</h2> 201 219 <form action="options.php" method="post" id="simpleCC-options-form"> 202 220 <?php settings_fields('simpleCC_options'); ?> … … 208 226 •Copy the access token and paste it in the input box below labeled <strong>"Constant Contact Access Token"</strong>.<br /> 209 227 </p> 228 <h3 class="title">Usage</h3> 229 <p>Put shortcode <strong>[simpleCC]</strong> wherever you want the form displayed. 230 </p> 210 231 </div> 211 232 <hr> … … 214 235 <tr> 215 236 <th scope="row"> 216 <label for="simpleCC_ listname">Constant Contact Access Token: </label>237 <label for="simpleCC_accesstoken">Constant Contact Access Token: </label> 217 238 </th> 218 239 <td> … … 234 255 </td> 235 256 </tr> 257 <tr> 258 <th scope="row"> 259 <label for="simpleCC_listname">Success Message: </label> 260 </th> 261 262 <td> 263 <input type="text" size="35" id="simpleCC_message_successful" name="simpleCC_message_successful" value="<?php echo esc_attr( get_option('simpleCC_message_successful') ); ?>" /> 264 </td> 265 </tr> 236 266 </tbody> 237 267 </table> … … 245 275 function simpleCC_plugin_menu() 246 276 { 247 add_ menu_page('Simple Constant Contact','Simple Constant Contact', 'manage_options', 'simple-cc-plugin', array($this, 'simpleCC_option_page'));277 add_options_page('Simple Constant Contact', 'Simple Constant Contact', 9, 'simple-cc-plugin', array($this, 'simpleCC_option_page')); 248 278 } 249 279 … … 252 282 // test to see if all the settings are correct 253 283 if ($this->ready()) { 254 ?> 255 <div class="simpleCC_plugin"> 256 <form class="simpleCC_form" id="simpleCC_form" method="post"> 257 <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label> 258 <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label> 259 <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label> 260 <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button> 261 </form> 262 </div> 263 <?php 284 if ($_POST['simpleCC_submitted'] == 'success') { 285 $_POST['simpleCC_submitted'] = ''; 286 287 if (get_option('simpleCC_message_successful') == '') 288 $message = 'Thanks for subscribing!'; 289 else 290 $message = get_option('simpleCC_message_successful'); 291 292 return '<div class="simpleCC_plugin"><p id="simpleCC_error_message">'.$message.'</p></div>'; 293 } 294 else { 295 return '<div class="simpleCC_plugin"> 296 <p id="simpleCC_success_message"></p> 297 <p id="simpleCC_error_message"></p> 298 <form name="simpleCC_form" class="simpleCC_form" id="simpleCC_form" method="post" onsubmit="return simpleCC_message()"> 299 <label for="simpleCC_fname">First Name<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label> 300 <label for="simpleCC_lname">Last Name<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label> 301 <label for="simpleCC_email">Email<input type="email" id="simpleCC_email" name="simpleCC_email" /></label> 302 <input type="hidden" name="simpleCC_submitted" id="simpleCC_submitted" value="" /> 303 <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button> 304 </form> 305 </div>'; 306 } 264 307 } 308 } 309 310 // Custom javascript 311 function simpleCC_scripts_basic(){ 312 wp_register_script('simpleeCC_script', plugins_url('/js/simpleCC.js', __FILE__)); 313 wp_enqueue_script('simpleeCC_script'); 265 314 } 266 315 … … 272 321 add_shortcode('simpleCC', array($this, 'simpleCC_display_form')); 273 322 add_action('admin_menu', array($this, 'simpleCC_plugin_menu')); 323 324 // javascript 325 add_action( 'wp_enqueue_scripts', array($this, 'simpleCC_scripts_basic' )); 274 326 } 275 327
Note: See TracChangeset
for help on using the changeset viewer.