Version Description
- Initial release
Download this release
Release Info
Developer | adampickering |
Plugin | Simple Registration for WooCommerce |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- readme.txt +27 -0
- templates/registration-form.php +61 -0
- woocommerce-simple-registration.php +188 -0
readme.txt
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WooCommerce Simple Registration ===
|
2 |
+
Contributors: Astoundify, SpencerFinnell
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=contact@appthemer.com&item_name=Donation+for+Astoundify WP Job Manager Regions
|
4 |
+
Tags: woocommerce, woocommerce registration, woocommerce register, woocommerce registration form, woocommerce form
|
5 |
+
Requires at least: 3.6
|
6 |
+
Tested up to: 4.1
|
7 |
+
Stable tag: 1.0.0
|
8 |
+
License: GPLv3 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
+
|
11 |
+
A simple plugin to add a [woocommerce_simple_registration] shortcode to display the registration form on a separate page.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
A simple plugin to add a [woocommerce_simple_registration] shortcode to display the registration form on a separate page.
|
16 |
+
|
17 |
+
== Installation ==
|
18 |
+
|
19 |
+
1. Upload the folder `woocommerce-simple-registration to the `/wp-content/plugins/` directory
|
20 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
21 |
+
3. Use the shortcode `woocommerce_simple_registration` on a self-created page to display the registration form.
|
22 |
+
|
23 |
+
== Changelog ==
|
24 |
+
|
25 |
+
= 1.0.0 =
|
26 |
+
|
27 |
+
* Initial release
|
templates/registration-form.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Registration form.
|
4 |
+
*
|
5 |
+
* @author Jeroen Sormani
|
6 |
+
* @package WooCommerce-Simple-Registration
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
|
13 |
+
?><div class="registration-form woocommerce">
|
14 |
+
|
15 |
+
<?php wc_print_notices(); ?>
|
16 |
+
|
17 |
+
<h2><?php _e( 'Register', 'woocommerce' ); ?></h2>
|
18 |
+
|
19 |
+
<form method="post" class="register">
|
20 |
+
|
21 |
+
<?php do_action( 'woocommerce_register_form_start' ); ?>
|
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; ?>
|
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="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' ); ?>
|
58 |
+
|
59 |
+
</form>
|
60 |
+
|
61 |
+
</div>
|
woocommerce-simple-registration.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: WooCommerce Simple Registration
|
4 |
+
* Plugin URI: https://astoundify.com/
|
5 |
+
* Description: A simple plugin to add a [wc_register] shortcode to display the registration form on a separate page.
|
6 |
+
* Version: 1.0.0
|
7 |
+
* Author: Jeroen Sormani
|
8 |
+
* Author URI: https://astoundify.com/
|
9 |
+
* Text Domain: woocommerce-simple-registration
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class WooCommerce_Simple_Registration.
|
16 |
+
*
|
17 |
+
* Main WooCommerce_Simple_Registration class initializes the plugin.
|
18 |
+
*
|
19 |
+
* @class WooCommerce_Simple_Registration
|
20 |
+
* @version 1.0.0
|
21 |
+
* @author Jeroen Sormani
|
22 |
+
*/
|
23 |
+
class WooCommerce_Simple_Registration {
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Plugin version.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @var string $version Plugin version number.
|
31 |
+
*/
|
32 |
+
public $version = '1.0.0';
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Plugin file.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @var string $file Plugin file path.
|
40 |
+
*/
|
41 |
+
public $file = __FILE__;
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Instace of WooCommerce_Simple_Registration.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @access private
|
49 |
+
* @var object $instance The instance of WooCommerce_Simple_Registration.
|
50 |
+
*/
|
51 |
+
private static $instance;
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Construct.
|
56 |
+
*
|
57 |
+
* Initialize the class and plugin.
|
58 |
+
*
|
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
|
75 |
+
$this->init();
|
76 |
+
|
77 |
+
// woocommerce_simple_registration shortcode
|
78 |
+
add_shortcode( 'woocommerce_simple_registration', array( $this, 'registration_template' ) );
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Instance.
|
85 |
+
*
|
86 |
+
* An global instance of the class. Used to retrieve the instance
|
87 |
+
* to use on other files/plugins/themes.
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
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 |
+
*
|
106 |
+
* Initialize plugin parts.
|
107 |
+
*
|
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 |
+
*
|
121 |
+
* Load the textdomain based on WP language.
|
122 |
+
*
|
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 |
+
|
133 |
+
/**
|
134 |
+
* Registartion template.
|
135 |
+
*
|
136 |
+
* Return the registration template contents.
|
137 |
+
*
|
138 |
+
* @return string HTML registration form template.
|
139 |
+
*/
|
140 |
+
public function registration_template() {
|
141 |
+
|
142 |
+
ob_start();
|
143 |
+
|
144 |
+
if ( ! is_user_logged_in() ) :
|
145 |
+
|
146 |
+
$message = apply_filters( 'woocommerce_registration_message', '' );
|
147 |
+
|
148 |
+
if ( ! empty( $message ) ) :
|
149 |
+
wc_add_notice( $message );
|
150 |
+
endif;
|
151 |
+
|
152 |
+
wc_get_template( 'registration-form.php', array(), 'woocommerce-simple-registration/', plugin_dir_path( __FILE__ ) . 'templates/' );
|
153 |
+
|
154 |
+
else :
|
155 |
+
echo do_shortcode( '[woocommerce_my_account]' );
|
156 |
+
endif;
|
157 |
+
|
158 |
+
$return = ob_get_contents();
|
159 |
+
ob_end_clean();
|
160 |
+
|
161 |
+
return $return;
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
/**
|
170 |
+
* The main function responsible for returning the WooCommerce_Simple_Registration object.
|
171 |
+
*
|
172 |
+
* Use this function like you would a global variable, except without needing to declare the global.
|
173 |
+
*
|
174 |
+
* Example: <?php WooCommerce_Simple_Registration()->method_name(); ?>
|
175 |
+
*
|
176 |
+
* @since 1.0.0
|
177 |
+
*
|
178 |
+
* @return object WooCommerce_Simple_Registration class object.
|
179 |
+
*/
|
180 |
+
if ( ! function_exists( 'WooCommerce_Simple_Registration' ) ) :
|
181 |
+
|
182 |
+
function WooCommerce_Simple_Registration() {
|
183 |
+
return WooCommerce_Simple_Registration::instance();
|
184 |
+
}
|
185 |
+
|
186 |
+
endif;
|
187 |
+
|
188 |
+
WooCommerce_Simple_Registration();
|