PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.18
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.18
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 1.0.22 1.0.23 All 172 releases
userswp / widgets / register.php

register.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.18, at widgets/register.php

159 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 /**
7 * UsersWP register widget.
8 *
9 * @since 1.0.0
10 */
11 class UWP_Register_Widget extends WP_Super_Duper {
12
13 /**
14 * Register the registration widget with WordPress.
15 *
16 */
17 public function __construct() {
18
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 )
97
98 );
99
100 parent::__construct( $options );
101 }
102
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 = '' ) {
113
114 if ( is_user_logged_in() && ! is_admin() ) {
115 return false;
116 }
117
118 $defaults = array(
119 'form_title' => __( 'Register', 'userswp' ),
120 'css_class' => 'border-0',
121 'redirect_to' => '',
122 );
123
124 /**
125 * Parse incoming $args into an array and merge it with $defaults
126 */
127 $args = wp_parse_args( $args, $defaults );
128
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 }
132
133 if(isset($_REQUEST['uwp_form_id']) && !empty($_REQUEST['uwp_form_id'])){
134 $args['id'] = absint($_REQUEST['uwp_form_id']);
135 }
136
137 ob_start();
138
139 echo '<div class="uwp_widgets uwp_widget_register">';
140
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";
143
144 echo '<div class="uwp_page wpbs">';
145
146 uwp_get_template( $template, $args );
147
148 echo '</div>';
149
150 echo '</div>';
151
152 if(!wp_doing_ajax()){
153 uwp_password_strength_inline_js();
154 }
155
156 return ob_get_clean();
157
158 }
159 }