PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.73
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.73
1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 All 174 releases
← All changes | widgets/register.php +130 -45 1.0.221.2.73 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 if ( ! defined( 'ABSPATH' ) ) {
3 - exit;
3 + exit;
4 4 }
5 5
6 6 /**
7 7 * UsersWP register widget.
@@ -9,66 +9,151 @@
9 9 * @since 1.0.0
10 10 */
11 11 class UWP_Register_Widget extends WP_Super_Duper {
12 12
13 - public function __construct() {
13 + /**
14 + * Register the registration widget with WordPress.
15 + *
16 + */
17 + public function __construct() {
14 18
15 - $options = array(
16 - 'textdomain' => 'userswp',
17 - 'block-icon' => 'admin-site',
18 - 'block-category'=> 'widgets',
19 - 'block-keywords'=> "['userswp','register']",
20 - 'class_name' => __CLASS__,
21 - 'base_id' => 'uwp_register',
22 - 'name' => __('UWP > Register','userswp'),
23 - 'widget_ops' => array(
24 - 'classname' => 'uwp-register-class',
25 - 'description' => esc_html__('Displays register form.','userswp'),
26 - ),
27 - 'arguments' => array(
28 - 'title' => array(
29 - 'title' => __( 'Widget title', 'userswp' ),
30 - 'desc' => __( 'Enter widget title.', 'userswp' ),
31 - 'type' => 'text',
32 - 'desc_tip' => true,
33 - 'default' => '',
34 - 'advanced' => false
35 - ),
36 - )
19 + $options = array(
20 + 'textdomain' => 'userswp',
21 + 'block-icon' => 'admin-site',
22 + 'block-category' => 'widgets',
23 + 'block-keywords' => "['userswp','register']",
24 + 'class_name' => __CLASS__,
25 + 'base_id' => 'uwp_register',
26 + 'name' => __( 'UWP > Register', 'userswp' ),
27 + 'widget_ops' => array(
28 + 'classname' => 'uwp-register-class bsui',
29 + 'description' => esc_html__( 'Displays register form.', 'userswp' ),
30 + ),
31 + 'arguments' => array(
32 + 'id' => array(
33 + 'title' => __( 'Form', 'userswp' ),
34 + 'desc' => __( 'Select form.', 'userswp' ),
35 + 'type' => 'select',
36 + 'options' => uwp_get_register_forms_dropdown_options(),
37 + 'default' => 1,
38 + 'desc_tip' => true,
39 + 'advanced' => false
40 + ),
41 + 'limit' => array(
42 + 'title' => __( 'Display form having IDs', 'userswp' ),
43 + 'desc' => __( 'Enter comma separeted IDs to show limited forms', 'userswp' ),
44 + 'type' => 'text',
45 + 'desc_tip' => true,
46 + 'default' => '',
47 + 'advanced' => true
48 + ),
49 + 'title' => array(
50 + 'title' => __( 'Widget title', 'userswp' ),
51 + 'desc' => __( 'Enter widget title.', 'userswp' ),
52 + 'type' => 'text',
53 + 'desc_tip' => true,
54 + 'default' => '',
55 + 'advanced' => true
56 + ),
57 + 'form_title' => array(
58 + 'title' => __( 'Form Title', 'userswp' ),
59 + 'desc' => __( 'Enter the form title (or "0" for no title)', 'userswp' ),
60 + 'type' => 'text',
61 + 'desc_tip' => true,
62 + 'default' => '',
63 + 'placeholder' => __( 'Register', 'userswp' ),
64 + 'advanced' => true
65 + ),
66 + 'redirect_to' => array(
67 + 'type' => 'text',
68 + 'title' => __( 'Redirect to:', 'userswp' ),
69 + 'desc' => __( 'Enter the url you want to redirect after register.', 'userswp' ),
70 + 'placeholder' => '',
71 + 'default' => '',
72 + 'desc_tip' => true,
73 + 'advanced' => true
74 + ),
75 + 'design_style' => array(
76 + 'title' => __( 'Design Style', 'userswp' ),
77 + 'desc' => __( 'The design style to use.', 'userswp' ),
78 + 'type' => 'select',
79 + 'options' => array(
80 + "" => __( 'default', 'userswp' ),
81 + "bootstrap" => __( 'Style 1', 'userswp' ),
82 + ),
83 + 'default' => '',
84 + 'desc_tip' => true,
85 + 'advanced' => true
86 + ),
87 + 'css_class' => array(
88 + 'type' => 'text',
89 + 'title' => __( 'Extra class:', 'userswp' ),
90 + 'desc' => __( 'Give the wrapper an extra class so you can style things as you want.', 'userswp' ),
91 + 'placeholder' => '',
92 + 'default' => '',
93 + 'desc_tip' => true,
94 + 'advanced' => true,
95 + ),
96 + )
37 97
38 - );
98 + );
39 99
40 - parent::__construct( $options );
41 - }
100 + parent::__construct( $options );
101 + }
42 102
43 - public function output( $args = array(), $widget_args = array(), $content = '' ) {
103 + /**
104 + * The Super block output function.
105 + *
106 + * @param array $args
107 + * @param array $widget_args
108 + * @param string $content
109 + *
110 + * @return mixed|string|bool
111 + */
112 + public function output( $args = array(), $widget_args = array(), $content = '' ) {
44 113
45 - if (is_user_logged_in()) {
46 - return false;
47 - }
114 + if ( is_user_logged_in() && ! is_admin() ) {
115 + return false;
116 + }
48 117
49 - ob_start();
118 + $defaults = array(
119 + 'form_title' => __( 'Register', 'userswp' ),
120 + 'css_class' => 'border-0',
121 + 'redirect_to' => '',
122 + );
50 123
51 - echo '<div class="uwp_widgets uwp_widget_register">';
124 + /**
125 + * Parse incoming $args into an array and merge it with $defaults
126 + */
127 + $args = wp_parse_args( $args, $defaults );
52 128
53 - $temp_obj = new UsersWP_Templates();
129 + if(isset($_REQUEST['user_type']) && !empty($_REQUEST['user_type'])){
130 + $args['id'] = uwp_get_form_id_by_type(sanitize_text_field($_REQUEST['user_type']));
131 + }
54 132
55 - $template = $temp_obj->uwp_locate_template('register');
133 + if(isset($_REQUEST['uwp_form_id']) && !empty($_REQUEST['uwp_form_id'])){
134 + $args['id'] = absint($_REQUEST['uwp_form_id']);
135 + }
56 136
57 - echo '<div class="uwp_page">';
137 + ob_start();
58 138
59 - if ($template) {
60 - include($template);
61 - }
139 + echo '<div class="uwp_widgets uwp_widget_register">';
62 140
63 - echo '</div>';
141 + $design_style = ! empty( $args['design_style'] ) ? esc_attr( $args['design_style'] ) : uwp_get_option( "design_style", 'bootstrap' );
142 + $template = $design_style ? $design_style . "/register.php" : "register.php";
64 143
65 - echo '</div>';
144 + echo '<div class="uwp_page wpbs">';
66 145
67 - $output = ob_get_contents();
146 + uwp_get_template( $template, $args );
68 147
69 - ob_end_clean();
148 + echo '</div>';
70 149
71 - return trim($output);
150 + echo '</div>';
72 151
73 - }
152 + if(!wp_doing_ajax()){
153 + uwp_password_strength_inline_js();
154 + }
155 +
156 + return ob_get_clean();
157 +
158 + }
74 159 }