Simple Registration for WooCommerce - Version 1.2.0

Version Description

  • Update register form with latest WC. Enable Password Meter.
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.2.0

languages/woocommerce-simple-registration.pot ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1.0\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/woocommerce-simple-registration\n"
8
+ "POT-Creation-Date: 2016-03-07 23:56:45+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
+ #: templates/registration-form.php:17 templates/registration-form.php:54
18
+ msgid "Register"
19
+ msgstr ""
20
+
21
+ #: templates/registration-form.php:26
22
+ msgid "Username"
23
+ msgstr ""
24
+
25
+ #: templates/registration-form.php:33
26
+ msgid "Email address"
27
+ msgstr ""
28
+
29
+ #: templates/registration-form.php:40
30
+ msgid "Password"
31
+ msgstr ""
32
+
33
+ #: templates/registration-form.php:47
34
+ msgid "Anti-spam"
35
+ msgstr ""
36
+
37
+ #. Plugin Name of the plugin/theme
38
+ msgid "WooCommerce Simple Registration"
39
+ msgstr ""
40
+
41
+ #. Author URI of the plugin/theme
42
+ msgid "https://astoundify.com/"
43
+ msgstr ""
44
+
45
+ #. Description of the plugin/theme
46
+ msgid ""
47
+ "A simple plugin to add a [woocommerce_simple_registration] shortcode to "
48
+ "display the registration form on a separate page."
49
+ msgstr ""
50
+
51
+ #. Author of the plugin/theme
52
+ msgid "Astoundify"
53
+ msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.4.*
7
- Stable tag: 1.0.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -22,6 +22,14 @@ A simple plugin to add a [woocommerce_simple_registration] shortcode to display
22
 
23
  == Changelog ==
24
 
 
 
 
 
 
 
 
 
25
  = 1.0.1 =
26
 
27
  * woocommerce-simple-registration.php author, version text changes.
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.2.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
22
 
23
  == Changelog ==
24
 
25
+ = 1.2.0 =
26
+
27
+ * Update register form with latest WC. Enable Password Meter.
28
+
29
+ = 1.1.0 =
30
+
31
+ * Fix: Include .pot file
32
+
33
  = 1.0.1 =
34
 
35
  * woocommerce-simple-registration.php author, version text changes.
templates/registration-form.php CHANGED
@@ -8,7 +8,7 @@
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
-
12
 
13
  ?><div class="registration-form woocommerce">
14
 
@@ -22,23 +22,23 @@ if ( ! defined( 'ABSPATH' ) ) exit;
22
 
23
  <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
24
 
25
- <p class="form-row form-row-wide">
26
  <label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label>
27
- <input type="text" class="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="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="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="form-row form-row-wide">
40
  <label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
41
- <input type="password" class="input-text" name="password" id="reg_password" />
42
  </p>
43
 
44
  <?php endif; ?>
@@ -49,9 +49,9 @@ if ( ! defined( 'ABSPATH' ) ) exit;
49
  <?php do_action( 'woocommerce_register_form' ); ?>
50
  <?php do_action( 'register_form' ); ?>
51
 
52
- <p class="form-row">
53
- <?php wp_nonce_field( 'woocommerce-register' ); ?>
54
- <input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" />
55
  </p>
56
 
57
  <?php do_action( 'woocommerce_register_form_end' ); ?>
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
+ wp_enqueue_script( 'wc-password-strength-meter' );
12
 
13
  ?><div class="registration-form woocommerce">
14
 
22
 
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; ?>
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' ); ?>
woocommerce-simple-registration.php CHANGED
@@ -1,12 +1,13 @@
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.0.1
7
- * Author: Astoundify
8
- * Author URI: https://astoundify.com/
9
- * Text Domain: woocommerce-simple-registration
 
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -59,16 +60,8 @@ class WooCommerce_Simple_Registration {
59
  * @since 1.0.0
60
  */
61
  public function __construct() {
62
-
63
- // Check if WooCommerce is active
64
- if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
65
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
66
- }
67
-
68
- if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
69
- if ( ! is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
70
- return;
71
- }
72
  }
73
 
74
  // Initialize plugin parts
@@ -77,9 +70,10 @@ class WooCommerce_Simple_Registration {
77
  // woocommerce_simple_registration shortcode
78
  add_shortcode( 'woocommerce_simple_registration', array( $this, 'registration_template' ) );
79
 
 
 
80
  }
81
 
82
-
83
  /**
84
  * Instance.
85
  *
@@ -90,16 +84,13 @@ class WooCommerce_Simple_Registration {
90
  * @return object Instance of the class.
91
  */
92
  public static function instance() {
93
-
94
- if ( is_null( self::$instance ) ) :
95
  self::$instance = new self();
96
- endif;
97
 
98
  return self::$instance;
99
-
100
  }
101
 
102
-
103
  /**
104
  * init.
105
  *
@@ -108,13 +99,9 @@ class WooCommerce_Simple_Registration {
108
  * @since 1.0.0
109
  */
110
  public function init() {
111
-
112
- // Load textdomain
113
  $this->load_textdomain();
114
-
115
  }
116
 
117
-
118
  /**
119
  * Textdomain.
120
  *
@@ -123,10 +110,7 @@ class WooCommerce_Simple_Registration {
123
  * @since 1.0.0
124
  */
125
  public function load_textdomain() {
126
-
127
- // Load textdomain
128
  load_plugin_textdomain( 'woocommerce-simple-registration', false, basename( dirname( __FILE__ ) ) . '/languages' );
129
-
130
  }
131
 
132
 
@@ -162,6 +146,24 @@ class WooCommerce_Simple_Registration {
162
 
163
  }
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  }
167
 
@@ -185,4 +187,4 @@ if ( ! function_exists( 'WooCommerce_Simple_Registration' ) ) :
185
 
186
  endif;
187
 
188
- WooCommerce_Simple_Registration();
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.2.0
7
+ * Author: Astoundify
8
+ * Author URI: https://astoundify.com/
9
+ * Text Domain: woocommerce-simple-registration
10
+ * Domain Path: /languages
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
60
  * @since 1.0.0
61
  */
62
  public function __construct() {
63
+ if ( ! class_exists( 'WooCommerce' ) ) {
64
+ return;
 
 
 
 
 
 
 
 
65
  }
66
 
67
  // Initialize plugin parts
70
  // woocommerce_simple_registration shortcode
71
  add_shortcode( 'woocommerce_simple_registration', array( $this, 'registration_template' ) );
72
 
73
+ // add a body class on this page
74
+ add_filter( 'body_class', array( $this, 'body_class' ) );
75
  }
76
 
 
77
  /**
78
  * Instance.
79
  *
84
  * @return object Instance of the class.
85
  */
86
  public static function instance() {
87
+ if ( is_null( self::$instance ) ) {
 
88
  self::$instance = new self();
89
+ }
90
 
91
  return self::$instance;
 
92
  }
93
 
 
94
  /**
95
  * init.
96
  *
99
  * @since 1.0.0
100
  */
101
  public function init() {
 
 
102
  $this->load_textdomain();
 
103
  }
104
 
 
105
  /**
106
  * Textdomain.
107
  *
110
  * @since 1.0.0
111
  */
112
  public function load_textdomain() {
 
 
113
  load_plugin_textdomain( 'woocommerce-simple-registration', false, basename( dirname( __FILE__ ) ) . '/languages' );
 
114
  }
115
 
116
 
146
 
147
  }
148
 
149
+ /**
150
+ * Add body classes for WC Simple Register page.
151
+ *
152
+ * @since 1.2.0
153
+ * @param array $classes
154
+ * @return array
155
+ */
156
+ function body_class( $classes ) {
157
+ $classes = (array) $classes;
158
+
159
+ if ( has_shortcode( get_post()->post_content, 'woocommerce_simple_registration' ) ) {
160
+ $classes[] = 'woocommerce-register';
161
+ $classes[] = 'woocommerce-account';
162
+ $classes[] = 'woocommerce-page';
163
+ }
164
+
165
+ return $classes;
166
+ }
167
 
168
  }
169
 
187
 
188
  endif;
189
 
190
+ add_action( 'plugins_loaded', 'WooCommerce_Simple_Registration' );