Version Description
- Update: Restrict temporary user to deactivate/delete Temporary Login Without Password plugin
Download this release
Release Info
Developer | storeapps |
Plugin | Temporary Login Without Password |
Version | 1.4.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.4 to 1.4.5
- admin/class-wp-temporary-login-without-password-admin.php +451 -380
- admin/js/wp-temporary-login-without-password-admin.js +63 -58
- includes/class-wp-temporary-login-without-password-common.php +439 -439
- includes/class-wp-temporary-login-without-password.php +4 -1
- languages/temporary-login-without-password.pot +59 -59
- readme.txt +6 -2
- templates/new_login.php +9 -9
- temporary-login-without-password.php +1 -1
admin/class-wp-temporary-login-without-password-admin.php
CHANGED
@@ -2,385 +2,456 @@
|
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Admin {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
}
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Admin {
|
4 |
|
5 |
+
private $plugin_name;
|
6 |
+
private $version;
|
7 |
+
|
8 |
+
public function __construct( $plugin_name, $version ) {
|
9 |
+
|
10 |
+
$this->plugin_name = $plugin_name;
|
11 |
+
$this->version = $version;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function enqueue_styles() {
|
15 |
+
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wp-temporary-login-without-password-admin.css', array(), $this->version, 'all' );
|
16 |
+
|
17 |
+
wp_enqueue_style( 'jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
|
18 |
+
}
|
19 |
+
|
20 |
+
public function enqueue_scripts() {
|
21 |
+
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-temporary-login-without-password-admin.js', array( 'jquery' ), $this->version, false );
|
22 |
+
wp_enqueue_script( 'clipboardjs', plugin_dir_url( __FILE__ ) . 'js/clipboard.min.js', array( 'jquery' ), $this->version, false );
|
23 |
+
|
24 |
+
wp_enqueue_script( 'jquery' );
|
25 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
26 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
27 |
+
|
28 |
+
$data = array(
|
29 |
+
'admin_ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
|
30 |
+
);
|
31 |
+
|
32 |
+
wp_localize_script( $this->plugin_name, 'data', $data );
|
33 |
+
}
|
34 |
+
|
35 |
+
public function admin_menu() {
|
36 |
+
$current_user_id = get_current_user_id();
|
37 |
+
if ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) ) {
|
38 |
+
add_users_page( __( 'Temporary Logins', 'temporary-login-without-password' ), __( 'Temporary Logins', 'temporary-login-without-password' ), apply_filters( 'tempadmin_user_cap', 'manage_options' ), 'wp-temporary-login-without-password', array( __class__, 'admin_settings' ) );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
public static function admin_settings() {
|
43 |
+
$_template_file = WTLWP_PLUGIN_DIR . '/templates/admin_settings.php';
|
44 |
+
$wtlwp_generated_url = ! empty( $_REQUEST['wtlwp_generated_url'] ) ? $_REQUEST['wtlwp_generated_url'] : '';
|
45 |
+
$user_email = ! empty( $_REQUEST['user_email'] ) ? $_REQUEST['user_email'] : '';
|
46 |
+
include $_template_file;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function create_user() {
|
50 |
+
|
51 |
+
if ( empty( $_POST['wtlwp_data'] ) || empty( $_POST['wtlwp-nonce'] ) ) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
$data = $_POST['wtlwp_data'];
|
56 |
+
$email = $data['user_email'];
|
57 |
+
$error = false;
|
58 |
+
|
59 |
+
$redirect_link = '';
|
60 |
+
if ( false == Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
61 |
+
$result = array(
|
62 |
+
'status' => 'error',
|
63 |
+
'message' => 'unathorised_access',
|
64 |
+
);
|
65 |
+
$error = true;
|
66 |
+
} elseif ( ! wp_verify_nonce( $_POST['wtlwp-nonce'], 'wtlwp_generate_login_url' ) ) {
|
67 |
+
$result = array(
|
68 |
+
'status' => 'error',
|
69 |
+
'message' => 'nonce_failed',
|
70 |
+
);
|
71 |
+
$error = true;
|
72 |
+
} elseif ( empty( $data['user_email'] ) ) {
|
73 |
+
$result = array(
|
74 |
+
'status' => 'error',
|
75 |
+
'message' => 'empty_email',
|
76 |
+
);
|
77 |
+
$error = true;
|
78 |
+
} elseif ( ! is_email( $email ) ) {
|
79 |
+
$result = array(
|
80 |
+
'status' => 'error',
|
81 |
+
'message' => 'not_valid_email',
|
82 |
+
);
|
83 |
+
$error = true;
|
84 |
+
} elseif ( ! empty( $data['user_email'] ) && email_exists( $data['user_email'] ) ) {
|
85 |
+
$result = array(
|
86 |
+
'status' => 'error',
|
87 |
+
'message' => 'email_is_in_use',
|
88 |
+
);
|
89 |
+
$error = true;
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( ! $error ) {
|
93 |
+
$user = Wp_Temporary_Login_Without_Password_Common::create_new_user( $data );
|
94 |
+
if ( ! empty( $user['error'] ) ) {
|
95 |
+
$result = array(
|
96 |
+
'status' => 'error',
|
97 |
+
'message' => 'user_creation_failed',
|
98 |
+
);
|
99 |
+
} else {
|
100 |
+
$result = array(
|
101 |
+
'status' => 'success',
|
102 |
+
'message' => 'user_created',
|
103 |
+
);
|
104 |
+
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
105 |
+
$redirect_link = add_query_arg( 'wtlwp_generated_url', Wp_Temporary_Login_Without_Password_Common::get_login_url( $user ), $redirect_link );
|
106 |
+
$redirect_link = add_query_arg( 'user_email', $email, $redirect_link );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( empty( $redirect_link ) ) {
|
111 |
+
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
112 |
+
}
|
113 |
+
|
114 |
+
wp_redirect( $redirect_link, 302 );
|
115 |
+
exit();
|
116 |
+
}
|
117 |
+
|
118 |
+
public static function delete_user() {
|
119 |
+
|
120 |
+
if ( (false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp()) || empty( $_REQUEST['wtlwp_action'] ) || ($_REQUEST['wtlwp_action'] != 'delete') || empty( $_REQUEST['user_id'] ) || (absint( $_REQUEST['user_id'] ) == 0) ) {
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
|
124 |
+
$user_id = absint( $_REQUEST['user_id'] );
|
125 |
+
$nonce = $_REQUEST['manage-temporary-login'];
|
126 |
+
$redirect_url = '';
|
127 |
+
$error = false;
|
128 |
+
if ( ! wp_verify_nonce( $nonce, 'manage-temporary-login_' . $user_id ) ) {
|
129 |
+
$result = array(
|
130 |
+
'status' => 'error',
|
131 |
+
'message' => 'nonce_failed',
|
132 |
+
);
|
133 |
+
$error = true;
|
134 |
+
} elseif ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, false ) ) {
|
135 |
+
$result = array(
|
136 |
+
'status' => 'error',
|
137 |
+
'message' => 'is_not_temporary_login',
|
138 |
+
);
|
139 |
+
$error = true;
|
140 |
+
}
|
141 |
+
|
142 |
+
if ( ! $error ) {
|
143 |
+
$delete_user = wp_delete_user( absint( $user_id ), get_current_user_id() );
|
144 |
+
if ( ! is_wp_error( $delete_user ) ) {
|
145 |
+
$result = array(
|
146 |
+
'status' => 'success',
|
147 |
+
'message' => 'user_deleted',
|
148 |
+
);
|
149 |
+
} else {
|
150 |
+
$result = array(
|
151 |
+
'status' => 'error',
|
152 |
+
'message' => 'default_error_message',
|
153 |
+
);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
$redirect_url = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
158 |
+
wp_redirect( $redirect_url, 302 );
|
159 |
+
exit();
|
160 |
+
}
|
161 |
+
|
162 |
+
public static function manage_temporary_login() {
|
163 |
+
|
164 |
+
if ( (false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp()) || empty( $_REQUEST['wtlwp_action'] ) || ($_REQUEST['wtlwp_action'] != 'disable' && $_REQUEST['wtlwp_action'] != 'enable') || empty( $_REQUEST['user_id'] ) || (absint( $_REQUEST['user_id'] ) == 0) ) {
|
165 |
+
return;
|
166 |
+
}
|
167 |
+
|
168 |
+
$error = false;
|
169 |
+
$user_id = absint( $_REQUEST['user_id'] );
|
170 |
+
$action = $_REQUEST['wtlwp_action'];
|
171 |
+
$nonce = $_REQUEST['manage-temporary-login'];
|
172 |
+
|
173 |
+
$is_valid_temporary_user = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, false );
|
174 |
+
|
175 |
+
if ( ! $is_valid_temporary_user ) {
|
176 |
+
$result = array(
|
177 |
+
'status' => 'error',
|
178 |
+
'message' => 'is_not_temporary_login',
|
179 |
+
);
|
180 |
+
$error = true;
|
181 |
+
} elseif ( ! wp_verify_nonce( $nonce, 'manage-temporary-login_' . $user_id ) ) {
|
182 |
+
$result = array(
|
183 |
+
'status' => 'error',
|
184 |
+
'message' => 'nonce_failed',
|
185 |
+
);
|
186 |
+
$error = true;
|
187 |
+
}
|
188 |
+
|
189 |
+
if ( ! $error ) {
|
190 |
+
if ( $action == 'disable' ) {
|
191 |
+
$disable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'disable' );
|
192 |
+
if ( $disable_login ) {
|
193 |
+
$result = array(
|
194 |
+
'status' => 'success',
|
195 |
+
'message' => 'login_disabled',
|
196 |
+
);
|
197 |
+
} else {
|
198 |
+
$result = array(
|
199 |
+
'status' => 'error',
|
200 |
+
'message' => 'default_error_message',
|
201 |
+
);
|
202 |
+
$error = true;
|
203 |
+
}
|
204 |
+
} elseif ( $action == 'enable' ) {
|
205 |
+
$enable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'enable' );
|
206 |
+
|
207 |
+
if ( $enable_login ) {
|
208 |
+
$result = array(
|
209 |
+
'status' => 'success',
|
210 |
+
'message' => 'login_enabled',
|
211 |
+
);
|
212 |
+
} else {
|
213 |
+
$result = array(
|
214 |
+
'status' => 'error',
|
215 |
+
'message' => 'default_error_message',
|
216 |
+
);
|
217 |
+
$error = true;
|
218 |
+
}
|
219 |
+
} else {
|
220 |
+
$result = array(
|
221 |
+
'status' => 'error',
|
222 |
+
'message' => 'invalid_action',
|
223 |
+
);
|
224 |
+
$error = true;
|
225 |
+
}// End if().
|
226 |
+
}// End if().
|
227 |
+
|
228 |
+
$redirect_link = Wp_Temporary_Login_Without_Password_Common::get_redirect_link( $result );
|
229 |
+
wp_redirect( $redirect_link, 302 );
|
230 |
+
exit();
|
231 |
+
}
|
232 |
+
|
233 |
+
public function display_admin_notices() {
|
234 |
+
|
235 |
+
if ( empty( $_REQUEST['page'] ) || (empty( $_REQUEST['page'] ) && $_REQUEST['page'] !== 'wp-temporary-login-without-password') || ! isset( $_REQUEST['wtlwp_message'] ) || ( ! isset( $_REQUEST['wtlwp_error'] ) && ! isset( $_REQUEST['wtlwp_success'] )) ) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
$class = $message = '';
|
240 |
+
$error = ! empty( $_REQUEST['wtlwp_error'] ) ? true : false;
|
241 |
+
$success = ! empty( $_REQUEST['wtlwp_success'] ) ? true : false;
|
242 |
+
if ( $error ) {
|
243 |
+
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_error_message';
|
244 |
+
switch ( $message_type ) {
|
245 |
+
case 'user_creation_failed':
|
246 |
+
$message = __( 'User creation failed', 'temporary-login-without-password' );
|
247 |
+
break;
|
248 |
+
|
249 |
+
case 'unathorised_access':
|
250 |
+
$message = __( 'You do not have permission to create a temporary login', 'temporary-login-without-password' );
|
251 |
+
break;
|
252 |
+
|
253 |
+
case 'email_is_in_use':
|
254 |
+
$message = __( 'Email already is in use', 'temporary-login-without-password' );
|
255 |
+
break;
|
256 |
+
|
257 |
+
case 'empty_email':
|
258 |
+
$message = __( 'Please enter valid email address. Email field should not be empty', 'temporary-login-without-password' );
|
259 |
+
break;
|
260 |
+
|
261 |
+
case 'not_valid_email':
|
262 |
+
$message = __( 'Please enter valid email address', 'temporary-login-without-password' );
|
263 |
+
break;
|
264 |
+
|
265 |
+
case 'is_not_temporary_login':
|
266 |
+
$message = __( 'User you are trying to delete is not temporary', 'temporary-login-without-password' );
|
267 |
+
break;
|
268 |
+
|
269 |
+
case 'nonce_failed':
|
270 |
+
$message = __( 'Nonce failed', 'temporary-login-without-password' );
|
271 |
+
break;
|
272 |
+
|
273 |
+
case 'invalid_action':
|
274 |
+
$message = __( 'Invalid action', 'temporary-login-without-password' );
|
275 |
+
break;
|
276 |
+
|
277 |
+
case 'default_error_message':
|
278 |
+
default:
|
279 |
+
$message = __( 'Unknown error occured', 'temporary-login-without-password' );
|
280 |
+
break;
|
281 |
+
}// End switch().
|
282 |
+
$class = 'error';
|
283 |
+
} elseif ( $success ) {
|
284 |
+
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_success_message';
|
285 |
+
switch ( $message_type ) {
|
286 |
+
case 'user_created':
|
287 |
+
$message = __( 'Login created successfully!', 'temporary-login-without-password' );
|
288 |
+
break;
|
289 |
+
|
290 |
+
case 'user_deleted':
|
291 |
+
$message = __( 'Login deleted successfully!', 'temporary-login-without-password' );
|
292 |
+
break;
|
293 |
+
|
294 |
+
case 'login_disabled':
|
295 |
+
$message = __( 'Login disabled successfully!', 'temporary-login-without-password' );
|
296 |
+
break;
|
297 |
+
|
298 |
+
case 'login_enabled':
|
299 |
+
$message = __( 'Login enabled successfully!', 'temporary-login-without-password' );
|
300 |
+
break;
|
301 |
+
|
302 |
+
default:
|
303 |
+
$message = __( 'Success!', 'temporary-login-without-password' );
|
304 |
+
break;
|
305 |
+
}
|
306 |
+
|
307 |
+
$class = 'updated';
|
308 |
+
}// End if().
|
309 |
+
|
310 |
+
$class .= ' notice notice-succe is-dismissible';
|
311 |
+
|
312 |
+
if ( ! empty( $message ) ) {
|
313 |
+
$notice = '';
|
314 |
+
$notice .= '<div id="notice" class="' . $class . '">';
|
315 |
+
$notice .= '<p>' . esc_attr( $message ) . '</p>';
|
316 |
+
$notice .= '</div>';
|
317 |
+
|
318 |
+
echo $notice;
|
319 |
+
}
|
320 |
+
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
*
|
326 |
+
* Disable welcome notification for temporary user.
|
327 |
+
*/
|
328 |
+
public function disable_welcome_notification( $blog_id, $user_id, $password, $title, $meta ) {
|
329 |
+
|
330 |
+
if ( ! empty( $user_id ) ) {
|
331 |
+
$check_expiry = false;
|
332 |
+
if ( Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, $check_expiry ) ) {
|
333 |
+
return false;
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
return true;
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Change the admin footer text on temporary login admin pages.
|
342 |
+
*
|
343 |
+
* @since 1.4.3
|
344 |
+
* @param string $footer_text
|
345 |
+
* @return string
|
346 |
+
*/
|
347 |
+
public function admin_footer_text( $footer_text ) {
|
348 |
+
|
349 |
+
$current_screen = get_current_screen();
|
350 |
+
|
351 |
+
if ( isset( $current_screen->id ) && $current_screen->id == 'users_page_wp-temporary-login-without-password' ) {
|
352 |
+
|
353 |
+
$can_ask_for_review = self::can_ask_for_review();
|
354 |
+
|
355 |
+
// Change the footer text
|
356 |
+
if ( $can_ask_for_review ) {
|
357 |
+
$footer_text = sprintf( __( 'If you like <strong>Temporary Login Without Password</strong> please leave us a %s rating. A huge thanks in advance!', 'temporary-login-without-password' ), '<a href="https://wordpress.org/support/plugin/temporary-login-without-password/reviews" target="_blank" class="tlwp-rating-link" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">★★★★★</a>' );
|
358 |
+
} else {
|
359 |
+
$footer_text = sprintf( __( 'Thank you for using %s.', 'temporary-login-without-password' ), '<a href="https://wordpress.org/plugins/temporary-login-without-password/" target="_blank">Temporary Login Without Password</a>' );
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
return $footer_text;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Triggered when clicking the rating footer.
|
368 |
+
*/
|
369 |
+
public static function tlwp_rated() {
|
370 |
+
update_option( 'tlwp_admin_footer_text_rated', 1 );
|
371 |
+
wp_die();
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Triggered when clicking the rating link from header.
|
376 |
+
*/
|
377 |
+
public static function tlwp_reivew_header() {
|
378 |
+
update_option( 'tlwp_admin_header_text_rated', 1 );
|
379 |
+
wp_die();
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Can we ask user for review?
|
384 |
+
*
|
385 |
+
* @since 1.4.5
|
386 |
+
*/
|
387 |
+
public static function can_ask_for_review() {
|
388 |
+
|
389 |
+
$tlwp_nobug = get_option( 'tlwp_no_bug', false );
|
390 |
+
$tlwp_rated = get_option( 'tlwp_admin_footer_text_rated', false );
|
391 |
+
$tlwp_rated_header = get_option( 'tlwp_admin_header_text_rated', false );
|
392 |
+
|
393 |
+
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
394 |
+
$total_logins = count( $temporary_logins );
|
395 |
+
|
396 |
+
if ( $tlwp_nobug || $tlwp_rated || $tlwp_rated_header || ($total_logins < 3) ) {
|
397 |
+
return false;
|
398 |
+
}
|
399 |
+
|
400 |
+
return true;
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Prepare a HTML for the review
|
405 |
+
*
|
406 |
+
* @since 1.4.5
|
407 |
+
*/
|
408 |
+
public function tlwp_ask_user_for_review() {
|
409 |
+
|
410 |
+
$current_screen = get_current_screen();
|
411 |
+
|
412 |
+
if ( isset( $current_screen->id ) && $current_screen->id == 'users_page_wp-temporary-login-without-password' ) {
|
413 |
+
|
414 |
+
$nobug = '';
|
415 |
+
|
416 |
+
if ( isset( $_GET['tlwpnobug'] ) ) {
|
417 |
+
$nobug = esc_attr( $_GET['tlwpnobug'] );
|
418 |
+
}
|
419 |
+
|
420 |
+
if ( 1 == $nobug ) {
|
421 |
+
update_option( 'tlwp_no_bug', true );
|
422 |
+
}
|
423 |
+
|
424 |
+
$can_ask_for_review = self::can_ask_for_review();
|
425 |
+
|
426 |
+
if ( $can_ask_for_review ) {
|
427 |
+
|
428 |
+
$reviewurl = 'https://wordpress.org/support/plugin/temporary-login-without-password/reviews/';
|
429 |
+
|
430 |
+
$nobugurl = add_query_arg( 'tlwpnobug', 1, menu_page_url( 'wp-temporary-login-without-password' ) );
|
431 |
+
|
432 |
+
echo '<div class="updated">';
|
433 |
+
|
434 |
+
echo sprintf( __( 'You have been using our plugin, do you like it? If so, please leave us a review with your feedback! <a href="%s" class="tlwp-rating-link-header" target="_blank" data-rated="' . esc_attr__( 'Thank You :) ', 'temporary-login-without-password' ) . '">Leave A Review</a> <a href="%s">No, Thanks</a>' ), $reviewurl, $nobugurl );
|
435 |
+
|
436 |
+
echo '</div>';
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Disable plugin deactivation link for the temporary user
|
443 |
+
*
|
444 |
+
* @since 1.4.5
|
445 |
+
*/
|
446 |
+
public function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
|
447 |
+
|
448 |
+
$current_user_id = get_current_user_id();
|
449 |
+
if ( Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) && ($plugin_file === 'temporary-login-without-password/temporary-login-without-password.php') ) {
|
450 |
+
unset( $actions['deactivate'] );
|
451 |
+
echo "<script> jQuery(document).ready(function() { jQuery('table.plugins tbody#the-list tr[data-slug=temporary-login-without-password] th.check-column input').attr('disabled', true); }); </script>";
|
452 |
+
}
|
453 |
+
|
454 |
+
return $actions;
|
455 |
+
}
|
456 |
|
457 |
}
|
admin/js/wp-temporary-login-without-password-admin.js
CHANGED
@@ -1,60 +1,65 @@
|
|
1 |
( function ( $ ) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
} )( jQuery );
|
1 |
( function ( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
jQuery( document ).ready( function () {
|
5 |
+
|
6 |
+
// jQuery('#new-wtlwp-form').hide();
|
7 |
+
jQuery( '#add-new-wtlwp-form-button' ).click( function () {
|
8 |
+
jQuery( '#new-wtlwp-form' ).show();
|
9 |
+
} );
|
10 |
+
|
11 |
+
jQuery( '#cancel-new-login-form' ).click( function () {
|
12 |
+
jQuery( '#new-wtlwp-form' ).hide();
|
13 |
+
} );
|
14 |
+
|
15 |
+
if ( jQuery( '.wtlwp-click-to-copy-btn' ).get( 0 ) ) {
|
16 |
+
|
17 |
+
var clipboard = new Clipboard( '.wtlwp-click-to-copy-btn' );
|
18 |
+
|
19 |
+
clipboard.on( 'success', function ( e ) {
|
20 |
+
var elem = e.trigger;
|
21 |
+
var className = elem.getAttribute( 'class' );
|
22 |
+
jQuery( '#copied-text-message-' + className ).text( 'Copied' ).fadeIn();
|
23 |
+
jQuery( '#copied-text-message-' + className ).fadeOut( 'slow' );
|
24 |
+
} );
|
25 |
+
}
|
26 |
+
|
27 |
+
if ( jQuery( '.wtlwp-copy-to-clipboard' ).get( 0 ) ) {
|
28 |
+
var clipboard_link = new Clipboard( '.wtlwp-copy-to-clipboard' );
|
29 |
+
|
30 |
+
clipboard_link.on( 'success', function ( e ) {
|
31 |
+
var elem = e.trigger;
|
32 |
+
var id = elem.getAttribute( 'id' );
|
33 |
+
jQuery( '#copied-' + id ).text( 'Copied' ).fadeIn();
|
34 |
+
jQuery( '#copied-' + id ).fadeOut( 'slow' );
|
35 |
+
} );
|
36 |
+
}
|
37 |
+
|
38 |
+
jQuery( '#user-expiry-time' ).change( function () {
|
39 |
+
|
40 |
+
var value = jQuery( this ).val();
|
41 |
+
if ( value === 'custom_date' ) {
|
42 |
+
var tomorrowDate = new Date( new Date().getTime() + 24 * 60 * 60 * 1000 );
|
43 |
+
jQuery( '.example-datepicker' ).datepicker( {
|
44 |
+
dateFormat: 'yy-mm-dd',
|
45 |
+
minDate: tomorrowDate
|
46 |
+
} );
|
47 |
+
jQuery( '#custom-date-picker' ).show();
|
48 |
+
} else {
|
49 |
+
jQuery( '#custom-date-picker' ).hide();
|
50 |
+
}
|
51 |
+
|
52 |
+
} );
|
53 |
+
|
54 |
+
jQuery( 'a.tlwp-rating-link' ).click( function ( ) {
|
55 |
+
jQuery.post( data.admin_ajax_url, { action: 'tlwp_rated' } );
|
56 |
+
jQuery( this ).parent( ).text( jQuery( this ).data( 'rated' ) );
|
57 |
+
} );
|
58 |
+
|
59 |
+
jQuery( 'a.tlwp-rating-link-header' ).click( function ( ) {
|
60 |
+
jQuery.post( data.admin_ajax_url, { action: 'tlwp_reivew_header' } );
|
61 |
+
jQuery( this ).parent( ).text( jQuery( this ).data( 'rated' ) );
|
62 |
+
} );
|
63 |
+
|
64 |
+
} );
|
65 |
} )( jQuery );
|
includes/class-wp-temporary-login-without-password-common.php
CHANGED
@@ -2,505 +2,505 @@
|
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Common {
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* get the expiry duration
|
76 |
-
*
|
77 |
-
* @param type $key
|
78 |
-
* @return boolean|array
|
79 |
-
*/
|
80 |
-
public static function get_expiry_options( $key = '' ) {
|
81 |
-
|
82 |
-
$expiry_duration = array(
|
83 |
-
'3_days' => __( 'Three Days', 'temporary-login-without-password' ),
|
84 |
-
'day' => __( 'One Day', 'temporary-login-without-password' ),
|
85 |
-
'3_hours' => __( 'Three Hours', 'temporary-login-without-password' ),
|
86 |
-
'hour' => __( 'One Hour', 'temporary-login-without-password' ),
|
87 |
-
'week' => __( 'One Week', 'temporary-login-without-password' ),
|
88 |
-
'month' => __( 'One Month', 'temporary-login-without-password' ),
|
89 |
-
'custom_date' => __( 'Custom Date', 'temporary-login-without-password' )
|
90 |
-
);
|
91 |
-
|
92 |
-
if ( empty( $key ) ) {
|
93 |
-
return $expiry_duration;
|
94 |
-
} elseif ( isset( $expiry_duration[ $key ] ) ) {
|
95 |
-
return $expiry_duration[ $key ];
|
96 |
-
} else {
|
97 |
-
return;
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
static function get_expiry_duration_html( $selected = '' ) {
|
103 |
-
|
104 |
-
$p = '';
|
105 |
-
$r = '';
|
106 |
-
|
107 |
-
$expiry_duration = self::get_expiry_options();
|
108 |
-
|
109 |
-
foreach ( $expiry_duration as $key => $label ) {
|
110 |
-
if ( $selected == $key ) {
|
111 |
-
$p = "\n\t<option selected='selected' value='" . esc_attr( $key ) . "'>$label</option>";
|
112 |
-
} else {
|
113 |
-
$r .= "\n\t<option value='" . esc_attr( $key ) . "'>$label</option>";
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
echo $p . $r;
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
public static function generate_password() {
|
122 |
-
return wp_generate_password( absint( 15 ), true, false );
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
public static function get_user_expire_time( $expiry_option = 'day', $date = '' ) {
|
127 |
-
|
128 |
-
$current_timestamp = self::get_current_gmt_timestamp();
|
129 |
-
|
130 |
-
switch ( $expiry_option ) {
|
131 |
-
case '3_days' :
|
132 |
-
$timestamp = DAY_IN_SECONDS * 3;
|
133 |
-
break;
|
134 |
-
|
135 |
-
case 'day':
|
136 |
-
$timestamp = DAY_IN_SECONDS;
|
137 |
-
break;
|
138 |
-
|
139 |
-
case '3_hours':
|
140 |
-
$timestamp = HOUR_IN_SECONDS * 3;
|
141 |
-
break;
|
142 |
-
|
143 |
-
case 'hour':
|
144 |
-
$timestamp = HOUR_IN_SECONDS;
|
145 |
-
break;
|
146 |
|
147 |
-
|
148 |
-
$timestamp = WEEK_IN_SECONDS;
|
149 |
-
break;
|
150 |
-
|
151 |
-
case 'month':
|
152 |
-
$timestamp = MONTH_IN_SECONDS;
|
153 |
-
break;
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
-
|
|
|
166 |
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
-
|
170 |
-
return strtotime( gmdate( 'Y-m-d H:i:s', time() ) );
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
|
|
175 |
|
176 |
-
|
177 |
-
'fields' => 'all',
|
178 |
-
'meta_key' => '_wtlwp_expire',
|
179 |
-
'order' => 'DESC',
|
180 |
-
'orderby' => 'meta_value',
|
181 |
-
'meta_query' => array(
|
182 |
-
0 => array(
|
183 |
-
'key' => '_wtlwp_user',
|
184 |
-
'value' => 1,
|
185 |
-
),
|
186 |
-
),
|
187 |
-
);
|
188 |
|
189 |
-
|
190 |
-
$args[ 'role' ] = $role;
|
191 |
-
}
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
198 |
|
199 |
-
|
|
|
|
|
200 |
|
201 |
-
|
|
|
|
|
202 |
|
203 |
-
|
|
|
|
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
} elseif ( $type == 'time_format' ) {
|
209 |
-
$type_format = get_option( 'time_format' );
|
210 |
-
}
|
211 |
|
212 |
-
|
|
|
|
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
217 |
|
218 |
-
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
|
222 |
-
|
223 |
|
224 |
-
|
|
|
225 |
|
226 |
-
|
227 |
|
228 |
-
|
229 |
-
return false;
|
230 |
-
}
|
231 |
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
|
238 |
-
|
239 |
-
if ( !empty( $result[ 'status' ] ) ) {
|
240 |
-
if ( $result[ 'status' ] == 'success' ) {
|
241 |
-
$query_string .= '&wtlwp_success=1';
|
242 |
-
} elseif ( $result[ 'status' ] == 'error' ) {
|
243 |
-
$query_string .= '&wtlwp_error=1';
|
244 |
-
}
|
245 |
-
}
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
|
251 |
-
|
252 |
|
253 |
-
|
254 |
|
255 |
-
|
256 |
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
-
|
260 |
-
$user_id = get_current_user_id();
|
261 |
-
}
|
262 |
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
|
267 |
-
|
268 |
|
269 |
-
|
270 |
|
271 |
-
|
272 |
|
273 |
-
|
274 |
|
275 |
-
|
276 |
-
$user_id = get_current_user_id();
|
277 |
-
}
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
|
283 |
-
|
284 |
|
285 |
-
|
|
|
|
|
286 |
|
287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
|
293 |
-
|
294 |
|
295 |
-
|
296 |
-
$users_data = array();
|
297 |
-
if ( empty( $token ) ) {
|
298 |
-
return false;
|
299 |
-
}
|
300 |
|
301 |
-
|
302 |
-
'fields' => $fields,
|
303 |
-
'meta_key' => '_wtlwp_expire',
|
304 |
-
'order' => 'DESC',
|
305 |
-
'orderby' => 'meta_value',
|
306 |
-
'meta_query' => array(
|
307 |
-
0 => array(
|
308 |
-
'key' => '_wtlwp_token',
|
309 |
-
'value' => sanitize_text_field( $token ),
|
310 |
-
'compare' => '=',
|
311 |
-
),
|
312 |
-
),
|
313 |
-
);
|
314 |
|
315 |
-
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
if ( $expire <= self::get_current_gmt_timestamp() ) {
|
325 |
-
unset( $users_data[ $key ] );
|
326 |
-
}
|
327 |
-
}
|
328 |
|
329 |
-
|
330 |
|
331 |
-
|
332 |
|
333 |
-
|
334 |
|
335 |
-
|
336 |
-
return false;
|
337 |
-
}
|
338 |
|
339 |
-
|
|
|
|
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
|
345 |
-
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
350 |
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
|
355 |
-
|
356 |
-
$args = array();
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
|
506 |
}
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Common {
|
4 |
|
5 |
+
public static function create_username( $data ) {
|
6 |
+
|
7 |
+
$first_name = isset( $data['user_first_name'] ) ? $data['user_first_name'] : '';
|
8 |
+
$last_name = isset( $data['user_last_name'] ) ? $data['user_last_name'] : '';
|
9 |
+
$email = isset( $data['user_email'] ) ? $data['user_email'] : '';
|
10 |
+
|
11 |
+
$name = '';
|
12 |
+
if ( ! empty( $first_name ) || ! empty( $last_name ) ) {
|
13 |
+
$name = str_replace( array( '.', '+' ), '', trim( $first_name . $last_name ) );
|
14 |
+
} else {
|
15 |
+
if ( ! empty( $email ) ) {
|
16 |
+
$explode = explode( '@', $email );
|
17 |
+
$name = str_replace( array( '.', '+' ), '', $explode[0] );
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
if ( username_exists( $name ) ) {
|
22 |
+
$name = $name . substr( uniqid( '', true ), -6 );
|
23 |
+
}
|
24 |
+
|
25 |
+
return sanitize_user( $name, true );
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
public static function create_new_user( $data ) {
|
30 |
+
|
31 |
+
if ( false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
$expiry_option = ! empty( $data['expiry'] ) ? $data['expiry'] : 'day';
|
36 |
+
$date = ! empty( $data['custom_date'] ) ? $data['custom_date'] : '';
|
37 |
+
|
38 |
+
$password = Wp_Temporary_Login_Without_Password_Common::generate_password();
|
39 |
+
$username = Wp_Temporary_Login_Without_Password_Common::create_username( $data );
|
40 |
+
$first_name = isset( $data['user_first_name'] ) ? sanitize_text_field( $data['user_first_name'] ) : '';
|
41 |
+
$last_name = isset( $data['user_last_name'] ) ? sanitize_text_field( $data['user_last_name'] ) : '';
|
42 |
+
$email = isset( $data['user_email'] ) ? sanitize_email( $data['user_email'] ) : '';
|
43 |
+
$user_args = array(
|
44 |
+
'first_name' => $first_name,
|
45 |
+
'last_name' => $last_name,
|
46 |
+
'user_login' => $username,
|
47 |
+
'user_pass' => $password,
|
48 |
+
'user_email' => sanitize_email( $email, true ),
|
49 |
+
'role' => $data['role'],
|
50 |
+
);
|
51 |
+
|
52 |
+
$user_id = wp_insert_user( $user_args );
|
53 |
+
|
54 |
+
if ( is_wp_error( $user_id ) ) {
|
55 |
+
$code = $user_id->get_error_code();
|
56 |
+
return array(
|
57 |
+
'error' => true,
|
58 |
+
'errcode' => $code,
|
59 |
+
'message' => $user_id->get_error_message( $code ),
|
60 |
+
);
|
61 |
+
}
|
62 |
+
|
63 |
+
update_user_meta( $user_id, '_wtlwp_user', true );
|
64 |
+
update_user_meta( $user_id, '_wtlwp_created', Wp_Temporary_Login_Without_Password_Common::get_current_gmt_timestamp() );
|
65 |
+
update_user_meta( $user_id, '_wtlwp_expire', Wp_Temporary_Login_Without_Password_Common::get_user_expire_time( $expiry_option, $date ) );
|
66 |
+
update_user_meta( $user_id, '_wtlwp_token', Wp_Temporary_Login_Without_Password_Common::generate_wtlwp_token( $user_id ) );
|
67 |
+
|
68 |
+
update_user_meta( $user_id, 'show_welcome_panel', 0 );
|
69 |
+
|
70 |
+
return $user_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
/**
|
75 |
+
* get the expiry duration
|
76 |
+
*
|
77 |
+
* @param type $key
|
78 |
+
* @return boolean|array
|
79 |
+
*/
|
80 |
+
public static function get_expiry_options( $key = '' ) {
|
81 |
+
|
82 |
+
$expiry_duration = array(
|
83 |
+
'3_days' => __( 'Three Days', 'temporary-login-without-password' ),
|
84 |
+
'day' => __( 'One Day', 'temporary-login-without-password' ),
|
85 |
+
'3_hours' => __( 'Three Hours', 'temporary-login-without-password' ),
|
86 |
+
'hour' => __( 'One Hour', 'temporary-login-without-password' ),
|
87 |
+
'week' => __( 'One Week', 'temporary-login-without-password' ),
|
88 |
+
'month' => __( 'One Month', 'temporary-login-without-password' ),
|
89 |
+
'custom_date' => __( 'Custom Date', 'temporary-login-without-password' ),
|
90 |
+
);
|
91 |
+
|
92 |
+
if ( empty( $key ) ) {
|
93 |
+
return $expiry_duration;
|
94 |
+
} elseif ( isset( $expiry_duration[ $key ] ) ) {
|
95 |
+
return $expiry_duration[ $key ];
|
96 |
+
} else {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
static function get_expiry_duration_html( $selected = '' ) {
|
103 |
|
104 |
+
$p = '';
|
105 |
+
$r = '';
|
106 |
|
107 |
+
$expiry_duration = self::get_expiry_options();
|
108 |
+
|
109 |
+
foreach ( $expiry_duration as $key => $label ) {
|
110 |
+
if ( $selected == $key ) {
|
111 |
+
$p = "\n\t<option selected='selected' value='" . esc_attr( $key ) . "'>$label</option>";
|
112 |
+
} else {
|
113 |
+
$r .= "\n\t<option value='" . esc_attr( $key ) . "'>$label</option>";
|
114 |
+
}
|
115 |
+
}
|
116 |
|
117 |
+
echo $p . $r;
|
|
|
118 |
|
119 |
+
}
|
120 |
|
121 |
+
public static function generate_password() {
|
122 |
+
return wp_generate_password( absint( 15 ), true, false );
|
123 |
|
124 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
+
public static function get_user_expire_time( $expiry_option = 'day', $date = '' ) {
|
|
|
|
|
127 |
|
128 |
+
$current_timestamp = self::get_current_gmt_timestamp();
|
129 |
|
130 |
+
switch ( $expiry_option ) {
|
131 |
+
case '3_days' :
|
132 |
+
$timestamp = DAY_IN_SECONDS * 3;
|
133 |
+
break;
|
134 |
|
135 |
+
case 'day':
|
136 |
+
$timestamp = DAY_IN_SECONDS;
|
137 |
+
break;
|
138 |
|
139 |
+
case '3_hours':
|
140 |
+
$timestamp = HOUR_IN_SECONDS * 3;
|
141 |
+
break;
|
142 |
|
143 |
+
case 'hour':
|
144 |
+
$timestamp = HOUR_IN_SECONDS;
|
145 |
+
break;
|
146 |
|
147 |
+
case 'week':
|
148 |
+
$timestamp = WEEK_IN_SECONDS;
|
149 |
+
break;
|
|
|
|
|
|
|
150 |
|
151 |
+
case 'month':
|
152 |
+
$timestamp = MONTH_IN_SECONDS;
|
153 |
+
break;
|
154 |
|
155 |
+
case 'custom_date':
|
156 |
+
$timestamp = strtotime( $date );
|
157 |
+
$current_timestamp = 0;
|
158 |
+
break;
|
159 |
|
160 |
+
default:
|
161 |
+
$timestamp = DAY_IN_SECONDS;
|
162 |
+
break;
|
163 |
+
}
|
164 |
|
165 |
+
return $current_timestamp + floatval( $timestamp );
|
166 |
|
167 |
+
}
|
168 |
|
169 |
+
public static function get_current_gmt_timestamp() {
|
170 |
+
return strtotime( gmdate( 'Y-m-d H:i:s', time() ) );
|
171 |
|
172 |
+
}
|
173 |
|
174 |
+
public static function get_temporary_logins( $role = '' ) {
|
|
|
|
|
175 |
|
176 |
+
$args = array(
|
177 |
+
'fields' => 'all',
|
178 |
+
'meta_key' => '_wtlwp_expire',
|
179 |
+
'order' => 'DESC',
|
180 |
+
'orderby' => 'meta_value',
|
181 |
+
'meta_query' => array(
|
182 |
+
0 => array(
|
183 |
+
'key' => '_wtlwp_user',
|
184 |
+
'value' => 1,
|
185 |
+
),
|
186 |
+
),
|
187 |
+
);
|
188 |
|
189 |
+
if ( ! empty( $role ) ) {
|
190 |
+
$args['role'] = $role;
|
191 |
+
}
|
192 |
|
193 |
+
$users = new WP_User_Query( $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
+
if ( ! ($users->results) ) {
|
196 |
+
return false;
|
197 |
+
}
|
198 |
|
199 |
+
return $users->results;
|
200 |
|
201 |
+
}
|
202 |
|
203 |
+
public static function format_date_display( $stamp = 0, $type = 'date_format' ) {
|
204 |
|
205 |
+
$type_format = 'date_format';
|
206 |
+
if ( $type == 'date_format' ) {
|
207 |
+
$type_format = get_option( 'date_format' );
|
208 |
+
} elseif ( $type == 'time_format' ) {
|
209 |
+
$type_format = get_option( 'time_format' );
|
210 |
+
}
|
211 |
|
212 |
+
$timezone = get_option( 'timezone_string' );
|
|
|
|
|
213 |
|
214 |
+
if ( empty( $timezone ) ) {
|
215 |
+
return date( $type_format, $stamp );
|
216 |
+
}
|
217 |
|
218 |
+
$date = new DateTime( '@' . $stamp );
|
219 |
|
220 |
+
$date->setTimezone( new DateTimeZone( $timezone ) );
|
221 |
|
222 |
+
return $date->format( $type_format );
|
223 |
|
224 |
+
}
|
225 |
|
226 |
+
public static function get_redirect_link( $result = array() ) {
|
|
|
|
|
227 |
|
228 |
+
if ( empty( $result ) ) {
|
229 |
+
return false;
|
230 |
+
}
|
231 |
|
232 |
+
$base_url = menu_page_url( 'wp-temporary-login-without-password', false );
|
233 |
|
234 |
+
if ( empty( $base_url ) ) {
|
235 |
+
return false;
|
236 |
+
}
|
237 |
|
238 |
+
$query_string = '';
|
239 |
+
if ( ! empty( $result['status'] ) ) {
|
240 |
+
if ( $result['status'] == 'success' ) {
|
241 |
+
$query_string .= '&wtlwp_success=1';
|
242 |
+
} elseif ( $result['status'] == 'error' ) {
|
243 |
+
$query_string .= '&wtlwp_error=1';
|
244 |
+
}
|
245 |
+
}
|
246 |
|
247 |
+
if ( ! empty( $result['message'] ) ) {
|
248 |
+
$query_string .= '&wtlwp_message=' . $result['message'];
|
249 |
+
}
|
250 |
|
251 |
+
$redirect_link = $base_url . $query_string;
|
252 |
|
253 |
+
return $redirect_link;
|
|
|
|
|
|
|
|
|
254 |
|
255 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
|
257 |
+
public static function can_manage_wtlwp( $user_id = 0 ) {
|
258 |
|
259 |
+
if ( empty( $user_id ) ) {
|
260 |
+
$user_id = get_current_user_id();
|
261 |
+
}
|
262 |
|
263 |
+
if ( empty( $user_id ) ) {
|
264 |
+
return false;
|
265 |
+
}
|
|
|
|
|
|
|
|
|
266 |
|
267 |
+
$check = get_user_meta( $user_id, '_wtlwp_user', true );
|
268 |
|
269 |
+
return ! empty( $check ) ? false : true;
|
270 |
|
271 |
+
}
|
272 |
|
273 |
+
public static function is_login_expired( $user_id = 0 ) {
|
|
|
|
|
274 |
|
275 |
+
if ( empty( $user_id ) ) {
|
276 |
+
$user_id = get_current_user_id();
|
277 |
+
}
|
278 |
|
279 |
+
if ( empty( $user_id ) ) {
|
280 |
+
return false;
|
281 |
+
}
|
282 |
|
283 |
+
$expire = get_user_meta( $user_id, '_wtlwp_expire', true );
|
284 |
|
285 |
+
return ! empty( $expire ) && self::get_current_gmt_timestamp() >= floatval( $expire ) ? true : false;
|
286 |
|
287 |
+
}
|
288 |
|
289 |
+
public static function generate_wtlwp_token( $user_id ) {
|
290 |
+
$str = $user_id . time() . uniqid( '', true );
|
291 |
+
return md5( $str );
|
292 |
|
293 |
+
}
|
|
|
294 |
|
295 |
+
public static function get_valid_user_based_on_wtlwp_token( $token = '', $user_id = 0, $fields = 'all' ) {
|
296 |
+
$users_data = array();
|
297 |
+
if ( empty( $token ) ) {
|
298 |
+
return false;
|
299 |
+
}
|
300 |
+
|
301 |
+
$args = array(
|
302 |
+
'fields' => $fields,
|
303 |
+
'meta_key' => '_wtlwp_expire',
|
304 |
+
'order' => 'DESC',
|
305 |
+
'orderby' => 'meta_value',
|
306 |
+
'meta_query' => array(
|
307 |
+
0 => array(
|
308 |
+
'key' => '_wtlwp_token',
|
309 |
+
'value' => sanitize_text_field( $token ),
|
310 |
+
'compare' => '=',
|
311 |
+
),
|
312 |
+
),
|
313 |
+
);
|
314 |
+
|
315 |
+
$users = new WP_User_Query( $args );
|
316 |
+
|
317 |
+
if ( empty( $users->results ) ) {
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
$users_data = $users->results;
|
322 |
+
foreach ( $users_data as $key => $user ) {
|
323 |
+
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
324 |
+
if ( $expire <= self::get_current_gmt_timestamp() ) {
|
325 |
+
unset( $users_data[ $key ] );
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
return $users_data;
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
public static function is_valid_temporary_login( $user_id = 0, $check_expiry = true ) {
|
334 |
+
|
335 |
+
if ( empty( $user_id ) ) {
|
336 |
+
return false;
|
337 |
+
}
|
338 |
+
|
339 |
+
$check = get_user_meta( $user_id, '_wtlwp_user', true );
|
340 |
+
|
341 |
+
if ( ! empty( $check ) && $check_expiry ) {
|
342 |
+
$check = ! (self::is_login_expired( $user_id ));
|
343 |
+
}
|
344 |
+
|
345 |
+
return ! empty( $check ) ? true : false;
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
public static function get_manage_login_url( $user_id, $action = '' ) {
|
350 |
+
|
351 |
+
if ( empty( $user_id ) || empty( $action ) ) {
|
352 |
+
return;
|
353 |
+
}
|
354 |
+
|
355 |
+
$base_url = menu_page_url( 'wp-temporary-login-without-password', false );
|
356 |
+
$args = array();
|
357 |
+
|
358 |
+
switch ( $action ) {
|
359 |
+
case 'disable';
|
360 |
+
$args = array(
|
361 |
+
'wtlwp_action' => 'disable',
|
362 |
+
'user_id' => $user_id,
|
363 |
+
);
|
364 |
+
break;
|
365 |
+
case 'enable';
|
366 |
+
$args = array(
|
367 |
+
'wtlwp_action' => 'enable',
|
368 |
+
'user_id' => $user_id,
|
369 |
+
);
|
370 |
+
break;
|
371 |
+
case 'delete';
|
372 |
+
$args = array(
|
373 |
+
'wtlwp_action' => 'delete',
|
374 |
+
'user_id' => $user_id,
|
375 |
+
);
|
376 |
+
break;
|
377 |
+
default:
|
378 |
+
break;
|
379 |
+
}
|
380 |
+
|
381 |
+
$manage_login_url = '';
|
382 |
+
if ( ! empty( $args ) ) {
|
383 |
+
$base_url = add_query_arg( $args, trailingslashit( $base_url ) );
|
384 |
+
$manage_login_url = wp_nonce_url( $base_url, 'manage-temporary-login_' . $user_id, 'manage-temporary-login' );
|
385 |
+
}
|
386 |
+
|
387 |
+
return $manage_login_url;
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
public static function get_login_url( $user_id ) {
|
392 |
+
|
393 |
+
if ( empty( $user_id ) ) {
|
394 |
+
return;
|
395 |
+
}
|
396 |
+
|
397 |
+
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
398 |
+
if ( ! $is_valid_temporary_login ) {
|
399 |
+
return;
|
400 |
+
}
|
401 |
+
|
402 |
+
$wtlwp_token = get_user_meta( $user_id, '_wtlwp_token', true );
|
403 |
+
if ( empty( $wtlwp_token ) ) {
|
404 |
+
return;
|
405 |
+
}
|
406 |
+
|
407 |
+
$login_url = add_query_arg( 'wtlwp_token', $wtlwp_token, trailingslashit( admin_url() ) );
|
408 |
+
|
409 |
+
return $login_url;
|
410 |
+
|
411 |
+
}
|
412 |
+
|
413 |
+
public static function manage_login( $user_id = 0, $action = '' ) {
|
414 |
+
|
415 |
+
if ( empty( $user_id ) || empty( $action ) ) {
|
416 |
+
return;
|
417 |
+
}
|
418 |
+
|
419 |
+
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
420 |
+
if ( ! $is_valid_temporary_login ) {
|
421 |
+
return;
|
422 |
+
}
|
423 |
+
|
424 |
+
$manage_login = false;
|
425 |
+
if ( $action == 'disable' ) {
|
426 |
+
$manage_login = update_user_meta( $user_id, '_wtlwp_expire', self::get_current_gmt_timestamp() );
|
427 |
+
} elseif ( $action == 'enable' ) {
|
428 |
+
$manage_login = update_user_meta( $user_id, '_wtlwp_expire', self::get_user_expire_time() );
|
429 |
+
}
|
430 |
+
|
431 |
+
if ( $manage_login ) {
|
432 |
+
return true;
|
433 |
+
}
|
434 |
+
|
435 |
+
return false;
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
public static function time_elapsed_string( $time, $ago = false ) {
|
440 |
+
|
441 |
+
if ( $ago ) {
|
442 |
+
$etime = self::get_current_gmt_timestamp() - $time;
|
443 |
+
} else {
|
444 |
+
$etime = $time - self::get_current_gmt_timestamp();
|
445 |
+
}
|
446 |
+
|
447 |
+
if ( $etime < 1 ) {
|
448 |
+
return __( 'Expired', 'temporary-login-without-password' );
|
449 |
+
}
|
450 |
+
|
451 |
+
$a = array(
|
452 |
+
// 365 * 24 * 60 * 60 => 'year',
|
453 |
+
// 30 * 24 * 60 * 60 => 'month',
|
454 |
+
24 * 60 * 60 => 'day',
|
455 |
+
60 * 60 => 'hour',
|
456 |
+
60 => 'minute',
|
457 |
+
1 => 'second',
|
458 |
+
);
|
459 |
+
|
460 |
+
$a_plural = array(
|
461 |
+
'year' => 'years',
|
462 |
+
'month' => 'months',
|
463 |
+
'day' => 'days',
|
464 |
+
'hour' => 'hours',
|
465 |
+
'minute' => 'minutes',
|
466 |
+
'second' => 'seconds',
|
467 |
+
);
|
468 |
+
|
469 |
+
foreach ( $a as $secs => $str ) {
|
470 |
+
$d = $etime / $secs;
|
471 |
+
|
472 |
+
if ( $d >= 1 ) {
|
473 |
+
$r = round( $d );
|
474 |
+
|
475 |
+
if ( $ago ) {
|
476 |
+
return __( sprintf( '%d %s ago', $r, ($r > 1 ? $a_plural[ $str ] : $str ) ), 'temporary-login-without-password' );
|
477 |
+
} else {
|
478 |
+
return __( sprintf( '%d %s remaining', $r, ($r > 1 ? $a_plural[ $str ] : $str ) ), 'temporary-login-without-password' );
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
}
|
484 |
+
|
485 |
+
public static function get_blocked_pages() {
|
486 |
+
$blocked_pages = array( 'wp-temporary-login-without-password', 'user-new.php', 'user-edit.php', 'profile.php' );
|
487 |
+
$blocked_pages = apply_filters( 'wtlwp_restricted_pages_for_temporary_users', $blocked_pages );
|
488 |
+
return $blocked_pages;
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
public static function delete_temporary_logins() {
|
493 |
+
|
494 |
+
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
495 |
+
|
496 |
+
if ( count( $temporary_logins ) > 0 ) {
|
497 |
+
foreach ( $temporary_logins as $user ) {
|
498 |
+
if ( $user instanceof WP_User ) {
|
499 |
+
$user = wp_delete_user( $user->ID ); // Delete User
|
500 |
+
}
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
}
|
505 |
|
506 |
}
|
includes/class-wp-temporary-login-without-password.php
CHANGED
@@ -9,7 +9,7 @@ class Wp_Temporary_Login_Without_Password {
|
|
9 |
public function __construct() {
|
10 |
|
11 |
$this->plugin_name = 'temporary-login-without-password';
|
12 |
-
$this->version = '1.4.
|
13 |
|
14 |
$this->load_dependencies();
|
15 |
$this->set_locale();
|
@@ -54,12 +54,15 @@ class Wp_Temporary_Login_Without_Password {
|
|
54 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'create_user' );
|
55 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'delete_user' );
|
56 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
|
|
|
57 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
|
58 |
|
59 |
$this->loader->add_action( 'wp_ajax_tlwp_rated', $plugin_admin, 'tlwp_rated' );
|
|
|
60 |
|
61 |
$this->loader->add_filter( 'wpmu_welcome_notification', $plugin_admin, 'disable_welcome_notification', 10, 5 );
|
62 |
$this->loader->add_filter( 'admin_footer_text', $plugin_admin, 'admin_footer_text', 1 );
|
|
|
63 |
}
|
64 |
|
65 |
private function define_public_hooks() {
|
9 |
public function __construct() {
|
10 |
|
11 |
$this->plugin_name = 'temporary-login-without-password';
|
12 |
+
$this->version = '1.4.5';
|
13 |
|
14 |
$this->load_dependencies();
|
15 |
$this->set_locale();
|
54 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'create_user' );
|
55 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'delete_user' );
|
56 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
|
57 |
+
$this->loader->add_action( 'admin_notices', $plugin_admin, 'tlwp_ask_user_for_review' );
|
58 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
|
59 |
|
60 |
$this->loader->add_action( 'wp_ajax_tlwp_rated', $plugin_admin, 'tlwp_rated' );
|
61 |
+
$this->loader->add_action( 'wp_ajax_tlwp_reivew_header', $plugin_admin, 'tlwp_reivew_header' );
|
62 |
|
63 |
$this->loader->add_filter( 'wpmu_welcome_notification', $plugin_admin, 'disable_welcome_notification', 10, 5 );
|
64 |
$this->loader->add_filter( 'admin_footer_text', $plugin_admin, 'admin_footer_text', 1 );
|
65 |
+
$this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'disable_plugin_deactivation', 10, 4 );
|
66 |
}
|
67 |
|
68 |
private function define_public_hooks() {
|
languages/temporary-login-without-password.pot
CHANGED
@@ -3,229 +3,229 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2017-
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
10 |
"Language: \n"
|
11 |
-
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION
|
12 |
"MIME-Version: 1.0\n"
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
-
"X-Generator: Loco https://localise.biz/"
|
16 |
|
17 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
18 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
19 |
-
#: temporary-login-without-password/templates/admin_settings.php:3
|
20 |
msgid "Temporary Logins"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
24 |
msgid "User creation failed"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
28 |
msgid "You do not have permission to create a temporary login"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
32 |
msgid "Email already is in use"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
36 |
msgid "Please enter valid email address. Email field should not be empty"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
40 |
msgid "Please enter valid email address"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
44 |
msgid "User you are trying to delete is not temporary"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
48 |
msgid "Nonce failed"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
52 |
msgid "Invalid action"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
56 |
msgid "Unknown error occured"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
60 |
msgid "Login created successfully!"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
64 |
msgid "Login deleted successfully!"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
68 |
msgid "Login disabled successfully!"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
72 |
msgid "Login enabled successfully!"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
76 |
msgid "Success!"
|
77 |
msgstr ""
|
78 |
|
79 |
#. %s: five stars
|
80 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
81 |
#, php-format
|
82 |
msgid ""
|
83 |
"If you like <strong>Temporary Login Without Password</strong> please leave "
|
84 |
"us a %s rating. A huge thanks in advance!"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
88 |
-
msgid "Thank You :)"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
92 |
#, php-format
|
93 |
msgid "Thank you for using %s."
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:83
|
97 |
msgid "Three Days"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:84
|
101 |
msgid "One Day"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:85
|
105 |
msgid "Three Hours"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:86
|
109 |
msgid "One Hour"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:87
|
113 |
msgid "One Week"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:88
|
117 |
msgid "One Month"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:89
|
121 |
msgid "Custom Date"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:448
|
125 |
msgid "Expired"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:9
|
129 |
msgid "Users"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:10
|
133 |
-
#: temporary-login-without-password/templates/new_login.php:19
|
134 |
msgid "Role"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:11
|
138 |
msgid "Last Logged In"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:12
|
142 |
-
#: temporary-login-without-password/templates/new_login.php:27
|
143 |
msgid "Expiry"
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:13
|
147 |
msgid "Actions"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:24
|
151 |
msgid "You have not created any temporary logins yet."
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:42
|
155 |
msgid "Not yet logged in"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:107
|
159 |
msgid "Reactivate for one day"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:109
|
163 |
msgid "Disable"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:112
|
167 |
msgid "Delete"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:113
|
171 |
msgid "Copy login link"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:16
|
175 |
msgid "Token empty"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:17
|
179 |
msgid "Authentication failed"
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:74
|
183 |
msgid "You don't have permission to access this page"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: temporary-login-without-password/templates/admin_settings.php:3
|
187 |
msgid "Create New"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: temporary-login-without-password/templates/admin_settings.php:13
|
191 |
msgid "Here's a temporary login link"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: temporary-login-without-password/templates/admin_settings.php:15
|
195 |
msgid "Click To Copy"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: temporary-login-without-password/templates/admin_settings.php:17
|
199 |
msgid ""
|
200 |
"User can directly login to wordpress admin panel without username and "
|
201 |
"password by opening this link."
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: temporary-login-without-password/templates/new_login.php:1
|
205 |
msgid "Create a new Temporary Login"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: temporary-login-without-password/templates/new_login.php:5
|
209 |
msgid "Email*"
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: temporary-login-without-password/templates/new_login.php:10
|
213 |
msgid "First Name"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: temporary-login-without-password/templates/new_login.php:15
|
217 |
msgid "Last Name"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: temporary-login-without-password/templates/new_login.php:44
|
221 |
msgid "Submit"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: temporary-login-without-password/templates/new_login.php:44
|
225 |
msgid "or"
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: temporary-login-without-password/templates/new_login.php:44
|
229 |
msgid "Cancel"
|
230 |
msgstr ""
|
231 |
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2017-11-13 04:56+0000\n"
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
10 |
"Language: \n"
|
11 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
|
12 |
"MIME-Version: 1.0\n"
|
13 |
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
+
"X-Generator: Loco - https://localise.biz/"
|
16 |
|
17 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:38
|
18 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:38
|
19 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:3
|
20 |
msgid "Temporary Logins"
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:246
|
24 |
msgid "User creation failed"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:250
|
28 |
msgid "You do not have permission to create a temporary login"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:254
|
32 |
msgid "Email already is in use"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:258
|
36 |
msgid "Please enter valid email address. Email field should not be empty"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:262
|
40 |
msgid "Please enter valid email address"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:266
|
44 |
msgid "User you are trying to delete is not temporary"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:270
|
48 |
msgid "Nonce failed"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:274
|
52 |
msgid "Invalid action"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:279
|
56 |
msgid "Unknown error occured"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:287
|
60 |
msgid "Login created successfully!"
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:291
|
64 |
msgid "Login deleted successfully!"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:295
|
68 |
msgid "Login disabled successfully!"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:299
|
72 |
msgid "Login enabled successfully!"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:303
|
76 |
msgid "Success!"
|
77 |
msgstr ""
|
78 |
|
79 |
#. %s: five stars
|
80 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:357
|
81 |
#, php-format
|
82 |
msgid ""
|
83 |
"If you like <strong>Temporary Login Without Password</strong> please leave "
|
84 |
"us a %s rating. A huge thanks in advance!"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:357
|
88 |
+
msgid "Thank You :) "
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:359
|
92 |
#, php-format
|
93 |
msgid "Thank you for using %s."
|
94 |
msgstr ""
|
95 |
|
96 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:83
|
97 |
msgid "Three Days"
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:84
|
101 |
msgid "One Day"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:85
|
105 |
msgid "Three Hours"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:86
|
109 |
msgid "One Hour"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:87
|
113 |
msgid "One Week"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:88
|
117 |
msgid "One Month"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:89
|
121 |
msgid "Custom Date"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:448
|
125 |
msgid "Expired"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:9
|
129 |
msgid "Users"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:10
|
133 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:19
|
134 |
msgid "Role"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:11
|
138 |
msgid "Last Logged In"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:12
|
142 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:27
|
143 |
msgid "Expiry"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:13
|
147 |
msgid "Actions"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:24
|
151 |
msgid "You have not created any temporary logins yet."
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:42
|
155 |
msgid "Not yet logged in"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:107
|
159 |
msgid "Reactivate for one day"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:109
|
163 |
msgid "Disable"
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:112
|
167 |
msgid "Delete"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:113
|
171 |
msgid "Copy login link"
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:16
|
175 |
msgid "Token empty"
|
176 |
msgstr ""
|
177 |
|
178 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:17
|
179 |
msgid "Authentication failed"
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:74
|
183 |
msgid "You don't have permission to access this page"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:3
|
187 |
msgid "Create New"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:13
|
191 |
msgid "Here's a temporary login link"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:15
|
195 |
msgid "Click To Copy"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:17
|
199 |
msgid ""
|
200 |
"User can directly login to wordpress admin panel without username and "
|
201 |
"password by opening this link."
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:1
|
205 |
msgid "Create a new Temporary Login"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:5
|
209 |
msgid "Email*"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:10
|
213 |
msgid "First Name"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:15
|
217 |
msgid "Last Name"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:44
|
221 |
msgid "Submit"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:44
|
225 |
msgid "or"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:44
|
229 |
msgid "Cancel"
|
230 |
msgstr ""
|
231 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: storeapps, niravmehta, malayladu
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CPTHCDC382KVA
|
4 |
Tags: admin login, custom login, customer access, customer login, secure login, access, admin, log in, login, login security, protection, user login, user login, wordpress admin login, wordpress login, wp-admin, wp-login, expiration, login, Login Without Password, temporary login, user, WordPress Admin, wp-admin, developer account, developer login, developer account, passwordless login, password less login
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.8
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,6 +40,10 @@ If you like Temporary Login Without Password, please leave a five star review on
|
|
40 |
|
41 |
== Changelog ==
|
42 |
|
|
|
|
|
|
|
|
|
43 |
= 1.4.4 =
|
44 |
|
45 |
- Bug Fixed: Trying to load scripts from unauthorized sources error.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CPTHCDC382KVA
|
4 |
Tags: admin login, custom login, customer access, customer login, secure login, access, admin, log in, login, login security, protection, user login, user login, wordpress admin login, wordpress login, wp-admin, wp-login, expiration, login, Login Without Password, temporary login, user, WordPress Admin, wp-admin, developer account, developer login, developer account, passwordless login, password less login
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.8.3
|
7 |
+
Stable tag: 1.4.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
|
41 |
== Changelog ==
|
42 |
|
43 |
+
= 1.4.5 =
|
44 |
+
|
45 |
+
- Update: Restrict temporary user to deactivate/delete Temporary Login Without Password plugin
|
46 |
+
|
47 |
= 1.4.4 =
|
48 |
|
49 |
- Bug Fixed: Trying to load scripts from unauthorized sources error.
|
templates/new_login.php
CHANGED
@@ -26,16 +26,16 @@
|
|
26 |
<tr class="form-field">
|
27 |
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"><?php echo __( 'Expiry', 'temporary-login-without-password' ); ?></label></th>
|
28 |
<td>
|
29 |
-
|
30 |
-
|
31 |
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html(); ?>
|
32 |
</select>
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
</td>
|
40 |
</tr>
|
41 |
|
@@ -46,4 +46,4 @@
|
|
46 |
</tr>
|
47 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
48 |
</table>
|
49 |
-
</form>
|
26 |
<tr class="form-field">
|
27 |
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"><?php echo __( 'Expiry', 'temporary-login-without-password' ); ?></label></th>
|
28 |
<td>
|
29 |
+
<span id="expiry-date-selection">
|
30 |
+
<select name="wtlwp_data[expiry]" id="user-expiry-time">
|
31 |
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html(); ?>
|
32 |
</select>
|
33 |
+
</span>
|
34 |
+
|
35 |
+
<span style="display:none;" id="custom-date-picker">
|
36 |
+
<input type="date" id="datepicker" name="wtlwp_data[custom_date]" value="" class="example-datepicker" />
|
37 |
+
</span>
|
38 |
+
|
39 |
</td>
|
40 |
</tr>
|
41 |
|
46 |
</tr>
|
47 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
48 |
</table>
|
49 |
+
</form>
|
temporary-login-without-password.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Temporary Login Without Password
|
5 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
6 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
7 |
-
* Version: 1.4.
|
8 |
* Author: StoreApps
|
9 |
* Author URI: http://storeapps.org
|
10 |
* Requires at least: 3.3
|
4 |
* Plugin Name: Temporary Login Without Password
|
5 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
6 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
7 |
+
* Version: 1.4.5
|
8 |
* Author: StoreApps
|
9 |
* Author URI: http://storeapps.org
|
10 |
* Requires at least: 3.3
|