Simple Registration for WooCommerce - Version 1.5.2

Version Description

Download this release

Release Info

Developer adampickering
Plugin Icon wp plugin Simple Registration for WooCommerce
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.3.0 to 1.5.2

languages/woocommerce-simple-registration.pot CHANGED
@@ -1,18 +1,18 @@
1
- # Copyright (C) 2016 Astoundify
2
- # This file is distributed under the same license as the WooCommerce Simple Registration package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Simple Registration 1.3.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-simple-registration\n"
8
- "POT-Creation-Date: 2016-11-16 01:42:08+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: grunt-wp-i18n 0.5.4\n"
16
 
17
  #: includes/wc-social-login.php:52
18
  msgid "Simple Registration"
@@ -38,20 +38,46 @@ msgstr ""
38
  msgid "Anti-spam"
39
  msgstr ""
40
 
41
- #: woocommerce-simple-registration.php:193
 
 
 
 
42
  msgid "First Name"
43
  msgstr ""
44
 
45
- #: woocommerce-simple-registration.php:198
46
  msgid "Last Name"
47
  msgstr ""
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  #. Plugin Name of the plugin/theme
50
- msgid "WooCommerce Simple Registration"
51
  msgstr ""
52
 
53
- #. Author URI of the plugin/theme
54
- msgid "https://astoundify.com/"
55
  msgstr ""
56
 
57
  #. Description of the plugin/theme
@@ -62,4 +88,8 @@ msgstr ""
62
 
63
  #. Author of the plugin/theme
64
  msgid "Astoundify"
 
 
 
 
65
  msgstr ""
1
+ # Copyright (C) 2017 Astoundify
2
+ # This file is distributed under the same license as the Simple Registration for WooCommerce package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Simple Registration for WooCommerce 1.5.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-simple-registration\n"
8
+ "POT-Creation-Date: 2017-10-02 14:09:27+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: grunt-wp-i18n1.0.0\n"
16
 
17
  #: includes/wc-social-login.php:52
18
  msgid "Simple Registration"
38
  msgid "Anti-spam"
39
  msgstr ""
40
 
41
+ #: templates/registration-form.php:58
42
+ msgid "Log in"
43
+ msgstr ""
44
+
45
+ #: woocommerce-simple-registration.php:203
46
  msgid "First Name"
47
  msgstr ""
48
 
49
+ #: woocommerce-simple-registration.php:208
50
  msgid "Last Name"
51
  msgstr ""
52
 
53
+ #: woocommerce-simple-registration.php:252
54
+ msgid "Registration page"
55
+ msgstr ""
56
+
57
+ #: woocommerce-simple-registration.php:253
58
+ msgid ""
59
+ "Use this page as WordPress registration URL. Page contents: "
60
+ "[woocommerce_simple_registration]"
61
+ msgstr ""
62
+
63
+ #: woocommerce-simple-registration.php:259
64
+ msgid "Select a page&hellip;"
65
+ msgstr ""
66
+
67
+ #: woocommerce-simple-registration.php:271
68
+ msgid "Enable first and last name fields."
69
+ msgstr ""
70
+
71
+ #: woocommerce-simple-registration.php:278
72
+ msgid "Require first and last name fields."
73
+ msgstr ""
74
+
75
  #. Plugin Name of the plugin/theme
76
+ msgid "Simple Registration for WooCommerce"
77
  msgstr ""
78
 
79
+ #. Plugin URI of the plugin/theme
80
+ msgid "https://astoundify.com/products/woocommerce-simple-registration/"
81
  msgstr ""
82
 
83
  #. Description of the plugin/theme
88
 
89
  #. Author of the plugin/theme
90
  msgid "Astoundify"
91
+ msgstr ""
92
+
93
+ #. Author URI of the plugin/theme
94
+ msgid "https://astoundify.com/"
95
  msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === WooCommerce Simple Registration ===
2
- Contributors: Astoundify, SpencerFinnell
3
  Donate link: https://www.paypal.me/astoundify
4
  Tags: woocommerce, woocommerce registration, woocommerce register, woocommerce registration form, woocommerce form
5
- Requires at least: 4.4
6
- Tested up to: 4.6
7
- Stable tag: 1.3.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -22,6 +22,24 @@ A simple plugin to add a [woocommerce_simple_registration] shortcode to display
22
 
23
  == Changelog ==
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  = 1.3.0: November 17, 2016 =
26
 
27
  * New: WooCommerce Social Login support. Add output in WooCommerce > Settings > Social Login.
1
+ === Simple Registration for WooCommerce ===
2
+ Contributors: Astoundify
3
  Donate link: https://www.paypal.me/astoundify
4
  Tags: woocommerce, woocommerce registration, woocommerce register, woocommerce registration form, woocommerce form
5
+ Requires at least: 4.7.0
6
+ Tested up to: 4.8.2
7
+ Stable tag: 1.5.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
22
 
23
  == Changelog ==
24
 
25
+ = 1.5.2: October 2, 2017 =
26
+
27
+ * Fix: Do not allow spam honeypot to autofill.
28
+
29
+ = 1.5.1: August 31, 2017 =
30
+
31
+ * Fix: Remove duplicate `register_form` hook.
32
+
33
+ = 1.5.0: August 23, 2017 =
34
+
35
+ * New: Option to enable First/Last name fields and mark required. WooCommerce > Settings > Accounts.
36
+ * New: Option to define the page the Register form appears on. Updates all default registration links. WooCommerce > Settings > Accounts.
37
+
38
+ = 1.4.0: April 12, 2017 =
39
+
40
+ * New: Update README.
41
+ * Fix: Update strings.
42
+
43
  = 1.3.0: November 17, 2016 =
44
 
45
  * New: WooCommerce Social Login support. Add output in WooCommerce > Settings > Social Login.
templates/registration-form.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Registration form.
4
  *
5
- * @author Jeroen Sormani
6
  * @package WooCommerce-Simple-Registration
7
  * @version 1.0.0
8
  */
@@ -14,7 +14,7 @@ wp_enqueue_script( 'wc-password-strength-meter' );
14
 
15
  <?php wc_print_notices(); ?>
16
 
17
- <h2><?php _e( 'Register', 'woocommerce' ); ?></h2>
18
 
19
  <form method="post" class="register">
20
 
@@ -23,35 +23,39 @@ wp_enqueue_script( 'wc-password-strength-meter' );
23
  <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
24
 
25
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
26
- <label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label>
27
  <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php if ( ! empty( $_POST['username'] ) ) echo esc_attr( $_POST['username'] ); ?>" />
28
  </p>
29
 
30
  <?php endif; ?>
31
 
32
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
33
- <label for="reg_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
34
  <input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
35
  </p>
36
 
37
  <?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
38
 
39
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
40
- <label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
41
  <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
42
  </p>
43
 
44
  <?php endif; ?>
45
 
46
  <!-- Spam Trap -->
47
- <div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
48
 
49
  <?php do_action( 'woocommerce_register_form' ); ?>
50
- <?php do_action( 'register_form' ); ?>
51
 
52
  <p class="woocomerce-FormRow form-row">
53
  <?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
54
- <input type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' ); ?>" />
 
 
 
 
55
  </p>
56
 
57
  <?php do_action( 'woocommerce_register_form_end' ); ?>
2
  /**
3
  * Registration form.
4
  *
5
+ * @author Astoundify
6
  * @package WooCommerce-Simple-Registration
7
  * @version 1.0.0
8
  */
14
 
15
  <?php wc_print_notices(); ?>
16
 
17
+ <h2><?php _e( 'Register', 'woocommerce-simple-registration' ); ?></h2>
18
 
19
  <form method="post" class="register">
20
 
23
  <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
24
 
25
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
26
+ <label for="reg_username"><?php _e( 'Username', 'woocommerce-simple-registration' ); ?> <span class="required">*</span></label>
27
  <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php if ( ! empty( $_POST['username'] ) ) echo esc_attr( $_POST['username'] ); ?>" />
28
  </p>
29
 
30
  <?php endif; ?>
31
 
32
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
33
+ <label for="reg_email"><?php _e( 'Email address', 'woocommerce-simple-registration' ); ?> <span class="required">*</span></label>
34
  <input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
35
  </p>
36
 
37
  <?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
38
 
39
  <p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
40
+ <label for="reg_password"><?php _e( 'Password', 'woocommerce-simple-registration' ); ?> <span class="required">*</span></label>
41
  <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
42
  </p>
43
 
44
  <?php endif; ?>
45
 
46
  <!-- Spam Trap -->
47
+ <div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce-simple-registration' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" autocomplete="off" /></div>
48
 
49
  <?php do_action( 'woocommerce_register_form' ); ?>
50
+ <?php do_action( 'woocommerce_simple_registration_form' ); ?>
51
 
52
  <p class="woocomerce-FormRow form-row">
53
  <?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
54
+ <input type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce-simple-registration' ); ?>" />
55
+ </p>
56
+
57
+ <p class="woocommerce-simple-registration-login-link">
58
+ <a href="<?php echo esc_url( wp_login_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Log in', 'woocommerce-simple-registration' ); ?></a>
59
  </p>
60
 
61
  <?php do_action( 'woocommerce_register_form_end' ); ?>
woocommerce-simple-registration.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
- * Plugin Name: WooCommerce Simple Registration
4
- * Plugin URI: https://astoundify.com/
5
  * Description: A simple plugin to add a [woocommerce_simple_registration] shortcode to display the registration form on a separate page.
6
- * Version: 1.3.0
7
  * Author: Astoundify
8
  * Author URI: https://astoundify.com/
9
  * Text Domain: woocommerce-simple-registration
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
  *
20
  * @class WooCommerce_Simple_Registration
21
  * @version 1.0.0
22
- * @author Jeroen Sormani
23
  */
24
  class WooCommerce_Simple_Registration {
25
 
@@ -30,7 +30,7 @@ class WooCommerce_Simple_Registration {
30
  * @since 1.0.0
31
  * @var string $version Plugin version number.
32
  */
33
- public $version = '1.3.0';
34
 
35
 
36
  /**
@@ -77,6 +77,12 @@ class WooCommerce_Simple_Registration {
77
  add_action( 'woocommerce_register_form_start', array( $this, 'add_name_input' ) );
78
  add_action( 'woocommerce_created_customer', array( $this, 'save_name_input' ) );
79
 
 
 
 
 
 
 
80
  /**
81
  * WooCommerce Social Login Support
82
  * @link http://www.woothemes.com/products/woocommerce-social-login/
@@ -184,19 +190,23 @@ class WooCommerce_Simple_Registration {
184
  * @since 1.3.0
185
  */
186
  public function add_name_input(){
 
 
 
 
187
  /* Filter to disable this feature. */
188
- if( ! apply_filters( 'woocommerce_simple_registration_name_fields', true ) ){
189
  return;
190
  }
191
  ?>
192
  <p class="woocommerce-FormRow woocommerce-FormRow--first form-row form-row-first">
193
- <label for="reg_sr_firstname"><?php _e( 'First Name', 'woocommerce-simple-registration' ); ?></label>
194
- <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="sr_firstname" id="reg_sr_firstname" value="<?php if ( ! empty( $_POST['sr_firstname'] ) ) echo esc_attr( $_POST['sr_firstname'] ); ?>" />
195
  </p>
196
 
197
  <p class="woocommerce-FormRow woocommerce-FormRow--last form-row form-row-last">
198
- <label for="reg_sr_lastname"><?php _e( 'Last Name', 'woocommerce-simple-registration' ); ?></label>
199
- <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="sr_lastname" id="reg_sr_lastname" value="<?php if ( ! empty( $_POST['sr_lastname'] ) ) echo esc_attr( $_POST['sr_lastname'] ); ?>" />
200
  </p>
201
  <?php
202
  }
@@ -207,8 +217,11 @@ class WooCommerce_Simple_Registration {
207
  * @see WC/includes/wc-user-functions.php line 114
208
  */
209
  public function save_name_input( $customer_id ){
 
 
 
210
  /* Filter to disable this feature. */
211
- if( ! apply_filters( 'woocommerce_simple_registration_name_fields', true ) ){
212
  return;
213
  }
214
 
@@ -225,6 +238,74 @@ class WooCommerce_Simple_Registration {
225
  }
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
229
 
230
 
1
  <?php
2
  /**
3
+ * Plugin Name: Simple Registration for WooCommerce
4
+ * Plugin URI: https://astoundify.com/products/woocommerce-simple-registration/
5
  * Description: A simple plugin to add a [woocommerce_simple_registration] shortcode to display the registration form on a separate page.
6
+ * Version: 1.5.2
7
  * Author: Astoundify
8
  * Author URI: https://astoundify.com/
9
  * Text Domain: woocommerce-simple-registration
19
  *
20
  * @class WooCommerce_Simple_Registration
21
  * @version 1.0.0
22
+ * @author Astoundify
23
  */
24
  class WooCommerce_Simple_Registration {
25
 
30
  * @since 1.0.0
31
  * @var string $version Plugin version number.
32
  */
33
+ public $version = '1.5.2';
34
 
35
 
36
  /**
77
  add_action( 'woocommerce_register_form_start', array( $this, 'add_name_input' ) );
78
  add_action( 'woocommerce_created_customer', array( $this, 'save_name_input' ) );
79
 
80
+ // Settings.
81
+ add_filter( 'woocommerce_account_settings', array( $this, 'account_settings' ) );
82
+
83
+ // Filter WP Register URL.
84
+ add_filter( 'register_url', array( $this, 'register_url' ) );
85
+
86
  /**
87
  * WooCommerce Social Login Support
88
  * @link http://www.woothemes.com/products/woocommerce-social-login/
190
  * @since 1.3.0
191
  */
192
  public function add_name_input(){
193
+ // Name Field Option.
194
+ $enabled = 'yes' === WC_Admin_Settings::get_option( 'woocommerce_simple_registration_name_fields', 'yes' ) ? true : false;
195
+ $required = 'yes' === WC_Admin_Settings::get_option( 'woocommerce_simple_registration_name_fields_required', 'no' ) ? true : false;
196
+
197
  /* Filter to disable this feature. */
198
+ if( ! apply_filters( 'woocommerce_simple_registration_name_fields', true ) || ! $enabled ){
199
  return;
200
  }
201
  ?>
202
  <p class="woocommerce-FormRow woocommerce-FormRow--first form-row form-row-first">
203
+ <label for="reg_sr_firstname"><?php _e( 'First Name', 'woocommerce-simple-registration' ); ?><?php echo( $required ? ' <span class="required">*</span>' : '' ) ?></label>
204
+ <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="sr_firstname" id="reg_sr_firstname" value="<?php if ( ! empty( $_POST['sr_firstname'] ) ) echo esc_attr( $_POST['sr_firstname'] ); ?>" <?php echo( $required ? ' required' : '' ) ?>/>
205
  </p>
206
 
207
  <p class="woocommerce-FormRow woocommerce-FormRow--last form-row form-row-last">
208
+ <label for="reg_sr_lastname"><?php _e( 'Last Name', 'woocommerce-simple-registration' ); ?><?php echo( $required ? ' <span class="required">*</span>' : '' ) ?></label>
209
+ <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="sr_lastname" id="reg_sr_lastname" value="<?php if ( ! empty( $_POST['sr_lastname'] ) ) echo esc_attr( $_POST['sr_lastname'] ); ?>" <?php echo( $required ? ' required' : '' ) ?> />
210
  </p>
211
  <?php
212
  }
217
  * @see WC/includes/wc-user-functions.php line 114
218
  */
219
  public function save_name_input( $customer_id ){
220
+ // Name Field Option.
221
+ $enable = 'yes' === WC_Admin_Settings::get_option( 'woocommerce_simple_registration_name_fields', 'yes' ) ? true : false;
222
+
223
  /* Filter to disable this feature. */
224
+ if( ! apply_filters( 'woocommerce_simple_registration_name_fields', true ) || ! $enable ){
225
  return;
226
  }
227
 
238
  }
239
  }
240
 
241
+ /**
242
+ * Settings
243
+ *
244
+ * @since 1.5.0
245
+ *
246
+ * @param array $settings WooCommerce Accounts Settings.
247
+ * @return array
248
+ */
249
+ public function account_settings( $settings ) {
250
+ $page = array(
251
+ array(
252
+ 'title' => __( 'Registration page', 'woocommerce-simple-registration' ),
253
+ 'desc' => __( 'Use this page as WordPress registration URL. Page contents: [woocommerce_simple_registration]', 'woocommerce-simple-registration' ),
254
+ 'id' => 'woocommerce_simple_registration_register_page',
255
+ 'default' => 0,
256
+ 'type' => 'single_select_page',
257
+ 'args' => array(
258
+ 'option_none_value' => 0,
259
+ 'show_option_none' => esc_html__( 'Select a page&hellip;', 'woocommerce-simple-registration' ),
260
+ ),
261
+ 'class' => 'wc-enhanced-select',
262
+ 'css' => 'min-width:300px;',
263
+ 'desc_tip' => true,
264
+ ),
265
+ );
266
+
267
+ array_splice( $settings, 2, 0, $page );
268
+
269
+ $name = array(
270
+ array(
271
+ 'desc' => __( 'Enable first and last name fields.', 'woocommerce-simple-registration' ),
272
+ 'id' => 'woocommerce_simple_registration_name_fields',
273
+ 'default' => 'yes',
274
+ 'checkboxgroup' => '',
275
+ 'type' => 'checkbox',
276
+ ),
277
+ array(
278
+ 'desc' => __( 'Require first and last name fields.', 'woocommerce-simple-registration' ),
279
+ 'id' => 'woocommerce_simple_registration_name_fields_required',
280
+ 'default' => 'no',
281
+ 'checkboxgroup' => '',
282
+ 'type' => 'checkbox',
283
+ ),
284
+ );
285
+
286
+ array_splice( $settings, 9, 0, $name );
287
+
288
+ return $settings;
289
+ }
290
+
291
+ /**
292
+ * Register URL
293
+ *
294
+ * @since 1.5.0
295
+ *
296
+ * @param string $url Registration URL.
297
+ * @return string $url
298
+ */
299
+ public function register_url( $url ) {
300
+ $register_page = WC_Admin_Settings::get_option( 'woocommerce_simple_registration_register_page', 0 );
301
+
302
+ if ( $register_page && get_permalink( $register_page ) ) {
303
+ $url = esc_url( get_permalink( $register_page ) );
304
+ }
305
+
306
+ return $url;
307
+ }
308
+
309
  }
310
 
311