Version Description
[01-29-2018] =
- Added: Now, admin can select roles from which they want to create a Tempoary Login.
- Fixed: Temporary User with 'administrator' role shows as a 'Super Admin' for WordPress single site installtion.
Download this release
Release Info
Developer | storeapps |
Plugin | Temporary Login Without Password |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
- admin/class-wp-temporary-login-without-password-admin.php +80 -75
- admin/css/wp-temporary-login-without-password-admin.css +50 -32
- admin/js/wp-temporary-login-without-password-admin.js +1 -1
- includes/class-wp-temporary-login-without-password-activator.php +10 -0
- includes/class-wp-temporary-login-without-password-common.php +84 -26
- includes/class-wp-temporary-login-without-password-deactivator.php +10 -2
- includes/class-wp-temporary-login-without-password-layout.php +33 -6
- includes/class-wp-temporary-login-without-password-loader.php +41 -2
- includes/class-wp-temporary-login-without-password.php +1 -8
- index.php +1 -1
- languages/temporary-login-without-password.pot +75 -58
- public/class-wp-temporary-login-without-password-public.php +5 -5
- readme.txt +12 -4
- screenshots/screenshot-3.png +0 -0
- templates/admin_settings.php +33 -32
- templates/list_temporary_logins.php +5 -5
- templates/new_login.php +65 -62
- templates/temporary_logins_settings.php +31 -20
- temporary-login-without-password.php +6 -2
- uninstall.php +1 -1
admin/class-wp-temporary-login-without-password-admin.php
CHANGED
@@ -8,12 +8,21 @@
|
|
8 |
* @since 1.0
|
9 |
* @package Temporary Login Without Password
|
10 |
*/
|
|
|
11 |
class Wp_Temporary_Login_Without_Password_Admin {
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
private $plugin_name;
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
private $version;
|
18 |
|
19 |
/**
|
@@ -70,7 +79,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
70 |
if ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) ) {
|
71 |
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(
|
72 |
__class__,
|
73 |
-
'admin_settings'
|
74 |
) );
|
75 |
}
|
76 |
}
|
@@ -88,6 +97,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
88 |
$tlwp_settings = maybe_unserialize( get_option( 'tlwp_settings', array() ) );
|
89 |
|
90 |
$default_role = ( ! empty( $tlwp_settings ) && isset( $tlwp_settings['default_role'] ) ) ? $tlwp_settings['default_role'] : 'administrator';
|
|
|
91 |
|
92 |
include $_template_file;
|
93 |
}
|
@@ -103,9 +113,10 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
-
$data
|
107 |
-
$email
|
108 |
-
$error
|
|
|
109 |
|
110 |
$redirect_link = '';
|
111 |
if ( false == Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
@@ -179,10 +190,16 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
179 |
|
180 |
$data = $_POST['tlwp_settings_data'];
|
181 |
|
182 |
-
$default_role = isset( $data['
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
$tlwp_settings = array(
|
185 |
-
'default_role' => $default_role
|
|
|
186 |
);
|
187 |
|
188 |
$update = update_option( 'tlwp_settings', maybe_serialize( $tlwp_settings ), true );
|
@@ -205,82 +222,41 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
205 |
}
|
206 |
|
207 |
/**
|
208 |
-
*
|
209 |
*
|
210 |
* @since 1.0
|
211 |
*/
|
212 |
-
public static function
|
213 |
|
214 |
-
|
|
|
215 |
return;
|
216 |
}
|
217 |
|
218 |
-
$
|
219 |
-
$nonce = $_REQUEST['manage-temporary-login'];
|
220 |
-
$redirect_url = '';
|
221 |
-
$error = false;
|
222 |
-
if ( ! wp_verify_nonce( $nonce, 'manage-temporary-login_' . $user_id ) ) {
|
223 |
-
$result = array(
|
224 |
-
'status' => 'error',
|
225 |
-
'message' => 'nonce_failed',
|
226 |
-
);
|
227 |
-
$error = true;
|
228 |
-
} elseif ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, false ) ) {
|
229 |
-
$result = array(
|
230 |
-
'status' => 'error',
|
231 |
-
'message' => 'is_not_temporary_login',
|
232 |
-
);
|
233 |
-
$error = true;
|
234 |
-
}
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
// If it's a super admin, we can't directly delete user from network site.
|
243 |
-
// We need to revoke super admin access and then delete user
|
244 |
-
if ( is_super_admin( $user_id ) ) {
|
245 |
-
revoke_super_admin( $user_id );
|
246 |
-
}
|
247 |
-
$delete_user = wpmu_delete_user( $user_id );
|
248 |
-
}
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
'status' => 'success',
|
253 |
-
'message' => 'user_deleted',
|
254 |
-
);
|
255 |
-
} else {
|
256 |
-
$result = array(
|
257 |
-
'status' => 'error',
|
258 |
-
'message' => 'default_error_message',
|
259 |
-
);
|
260 |
-
}
|
261 |
}
|
262 |
|
263 |
-
|
264 |
-
|
265 |
-
exit();
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Manage temporary logins
|
270 |
-
*
|
271 |
-
* @since 1.0
|
272 |
-
*/
|
273 |
-
public static function manage_temporary_login() {
|
274 |
-
|
275 |
-
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 ) ) {
|
276 |
return;
|
277 |
}
|
278 |
|
279 |
$error = false;
|
280 |
$user_id = absint( $_REQUEST['user_id'] );
|
281 |
-
$action = $_REQUEST['wtlwp_action'];
|
282 |
$nonce = $_REQUEST['manage-temporary-login'];
|
|
|
283 |
|
|
|
284 |
$is_valid_temporary_user = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, false );
|
285 |
|
286 |
if ( ! $is_valid_temporary_user ) {
|
@@ -298,7 +274,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
298 |
}
|
299 |
|
300 |
if ( ! $error ) {
|
301 |
-
if ( $action
|
302 |
$disable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'disable' );
|
303 |
if ( $disable_login ) {
|
304 |
$result = array(
|
@@ -310,9 +286,8 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
310 |
'status' => 'error',
|
311 |
'message' => 'default_error_message',
|
312 |
);
|
313 |
-
$error = true;
|
314 |
}
|
315 |
-
} elseif ( $action
|
316 |
$enable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'enable' );
|
317 |
|
318 |
if ( $enable_login ) {
|
@@ -325,14 +300,37 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
325 |
'status' => 'error',
|
326 |
'message' => 'default_error_message',
|
327 |
);
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
} else {
|
331 |
$result = array(
|
332 |
'status' => 'error',
|
333 |
'message' => 'invalid_action',
|
334 |
);
|
335 |
-
$error = true;
|
336 |
}// End if().
|
337 |
}// End if().
|
338 |
|
@@ -398,7 +396,6 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
398 |
$class = 'error';
|
399 |
} elseif ( $success ) {
|
400 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_success_message';
|
401 |
-
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_error_message';
|
402 |
switch ( $message_type ) {
|
403 |
case 'user_created':
|
404 |
$message = __( 'Login created successfully!', 'temporary-login-without-password' );
|
@@ -475,7 +472,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
475 |
|
476 |
$can_ask_for_review = self::can_ask_for_review();
|
477 |
|
478 |
-
// Change the footer text
|
479 |
if ( $can_ask_for_review ) {
|
480 |
$footer_text = sprintf( __( 'If you like <strong>Temporary Login Without Password</strong> plugin, 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>' );
|
481 |
} else {
|
@@ -552,9 +549,9 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
552 |
|
553 |
$nobugurl = add_query_arg( 'tlwpnobug', 1, menu_page_url( 'wp-temporary-login-without-password', false ) );
|
554 |
|
555 |
-
echo '<div class="
|
556 |
|
557 |
-
echo sprintf( __( 'You have been using <b>Temporary Login Without Password</b> 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 );
|
558 |
|
559 |
echo '</div>';
|
560 |
}
|
@@ -562,9 +559,17 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
562 |
}
|
563 |
|
564 |
/**
|
|
|
565 |
* Disable plugin deactivation link for the temporary user
|
566 |
*
|
|
|
|
|
|
|
|
|
|
|
567 |
* @since 1.4.5
|
|
|
|
|
568 |
*/
|
569 |
public function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
|
570 |
|
8 |
* @since 1.0
|
9 |
* @package Temporary Login Without Password
|
10 |
*/
|
11 |
+
|
12 |
class Wp_Temporary_Login_Without_Password_Admin {
|
13 |
|
14 |
+
/**
|
15 |
+
* @var string $plugin_name
|
16 |
+
*
|
17 |
+
* @since 1.0
|
18 |
+
*/
|
19 |
private $plugin_name;
|
20 |
|
21 |
+
/**
|
22 |
+
* @var string $version
|
23 |
+
*
|
24 |
+
* @since 1.0
|
25 |
+
*/
|
26 |
private $version;
|
27 |
|
28 |
/**
|
79 |
if ( ! Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id ) ) {
|
80 |
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(
|
81 |
__class__,
|
82 |
+
'admin_settings',
|
83 |
) );
|
84 |
}
|
85 |
}
|
97 |
$tlwp_settings = maybe_unserialize( get_option( 'tlwp_settings', array() ) );
|
98 |
|
99 |
$default_role = ( ! empty( $tlwp_settings ) && isset( $tlwp_settings['default_role'] ) ) ? $tlwp_settings['default_role'] : 'administrator';
|
100 |
+
$visible_roles = ( ! empty( $tlwp_settings ) && isset( $tlwp_settings['visible_roles'] ) ) ? $tlwp_settings['visible_roles'] : '';
|
101 |
|
102 |
include $_template_file;
|
103 |
}
|
113 |
return;
|
114 |
}
|
115 |
|
116 |
+
$data = $_POST['wtlwp_data'];
|
117 |
+
$email = $data['user_email'];
|
118 |
+
$error = false;
|
119 |
+
$result = array();
|
120 |
|
121 |
$redirect_link = '';
|
122 |
if ( false == Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
190 |
|
191 |
$data = $_POST['tlwp_settings_data'];
|
192 |
|
193 |
+
$default_role = isset( $data['default_role'] ) ? $data['default_role'] : 'administrator';
|
194 |
+
$visible_roles = isset( $data['visible_roles'] ) ? $data['visible_roles'] : array();
|
195 |
+
|
196 |
+
if ( ! in_array( $default_role, $visible_roles ) ) {
|
197 |
+
$visible_roles[] = $default_role;
|
198 |
+
}
|
199 |
|
200 |
$tlwp_settings = array(
|
201 |
+
'default_role' => $default_role,
|
202 |
+
'visible_roles' => $visible_roles,
|
203 |
);
|
204 |
|
205 |
$update = update_option( 'tlwp_settings', maybe_serialize( $tlwp_settings ), true );
|
222 |
}
|
223 |
|
224 |
/**
|
225 |
+
* Manage temporary logins
|
226 |
*
|
227 |
* @since 1.0
|
228 |
*/
|
229 |
+
public static function manage_temporary_login() {
|
230 |
|
231 |
+
// Don't have wtlwp_action or user_id? Say Good Bye...
|
232 |
+
if ( empty( $_REQUEST['wtlwp_action'] ) || empty( $_REQUEST['user_id'] ) ) {
|
233 |
return;
|
234 |
}
|
235 |
|
236 |
+
$action = $_REQUEST['wtlwp_action'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
+
// We support following actions
|
239 |
+
$valid_actions = array(
|
240 |
+
'disable',
|
241 |
+
'enable',
|
242 |
+
'delete',
|
243 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
+
if ( ! in_array( $action, $valid_actions ) ) {
|
246 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
+
// Can manage Temporary Logins? If yes..go ahead
|
250 |
+
if ( ( false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
return;
|
252 |
}
|
253 |
|
254 |
$error = false;
|
255 |
$user_id = absint( $_REQUEST['user_id'] );
|
|
|
256 |
$nonce = $_REQUEST['manage-temporary-login'];
|
257 |
+
$result = array();
|
258 |
|
259 |
+
// Perform action only on the valid temporary login
|
260 |
$is_valid_temporary_user = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user_id, false );
|
261 |
|
262 |
if ( ! $is_valid_temporary_user ) {
|
274 |
}
|
275 |
|
276 |
if ( ! $error ) {
|
277 |
+
if ( $action === 'disable' ) {
|
278 |
$disable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'disable' );
|
279 |
if ( $disable_login ) {
|
280 |
$result = array(
|
286 |
'status' => 'error',
|
287 |
'message' => 'default_error_message',
|
288 |
);
|
|
|
289 |
}
|
290 |
+
} elseif ( $action === 'enable' ) {
|
291 |
$enable_login = Wp_Temporary_Login_Without_Password_Common::manage_login( absint( $user_id ), 'enable' );
|
292 |
|
293 |
if ( $enable_login ) {
|
300 |
'status' => 'error',
|
301 |
'message' => 'default_error_message',
|
302 |
);
|
303 |
+
}
|
304 |
+
} elseif ( $action === 'delete' ) {
|
305 |
+
$delete_user = wp_delete_user( $user_id, get_current_user_id() );
|
306 |
+
|
307 |
+
// delete user from Multisite network too!
|
308 |
+
if ( is_multisite() ) {
|
309 |
+
|
310 |
+
// If it's a super admin, we can't directly delete user from network site.
|
311 |
+
// We need to revoke super admin access first and then delete user
|
312 |
+
if ( is_super_admin( $user_id ) ) {
|
313 |
+
revoke_super_admin( $user_id );
|
314 |
+
}
|
315 |
+
$delete_user = wpmu_delete_user( $user_id );
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( ! is_wp_error( $delete_user ) ) {
|
319 |
+
$result = array(
|
320 |
+
'status' => 'success',
|
321 |
+
'message' => 'user_deleted',
|
322 |
+
);
|
323 |
+
} else {
|
324 |
+
$result = array(
|
325 |
+
'status' => 'error',
|
326 |
+
'message' => 'default_error_message',
|
327 |
+
);
|
328 |
}
|
329 |
} else {
|
330 |
$result = array(
|
331 |
'status' => 'error',
|
332 |
'message' => 'invalid_action',
|
333 |
);
|
|
|
334 |
}// End if().
|
335 |
}// End if().
|
336 |
|
396 |
$class = 'error';
|
397 |
} elseif ( $success ) {
|
398 |
$message_type = ! empty( $_REQUEST['wtlwp_message'] ) ? $_REQUEST['wtlwp_message'] : 'default_success_message';
|
|
|
399 |
switch ( $message_type ) {
|
400 |
case 'user_created':
|
401 |
$message = __( 'Login created successfully!', 'temporary-login-without-password' );
|
472 |
|
473 |
$can_ask_for_review = self::can_ask_for_review();
|
474 |
|
475 |
+
// Change the footer text
|
476 |
if ( $can_ask_for_review ) {
|
477 |
$footer_text = sprintf( __( 'If you like <strong>Temporary Login Without Password</strong> plugin, 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>' );
|
478 |
} else {
|
549 |
|
550 |
$nobugurl = add_query_arg( 'tlwpnobug', 1, menu_page_url( 'wp-temporary-login-without-password', false ) );
|
551 |
|
552 |
+
echo '<div class="notice notice-warning">';
|
553 |
|
554 |
+
echo sprintf( __( '<p>You have been using <b>Temporary Login Without Password</b> 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></p>' ), $reviewurl, $nobugurl );
|
555 |
|
556 |
echo '</div>';
|
557 |
}
|
559 |
}
|
560 |
|
561 |
/**
|
562 |
+
*
|
563 |
* Disable plugin deactivation link for the temporary user
|
564 |
*
|
565 |
+
* @param $actions
|
566 |
+
* @param $plugin_file
|
567 |
+
* @param $plugin_data
|
568 |
+
* @param $context
|
569 |
+
*
|
570 |
* @since 1.4.5
|
571 |
+
*
|
572 |
+
* @return mixed
|
573 |
*/
|
574 |
public function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
|
575 |
|
admin/css/wp-temporary-login-without-password-admin.css
CHANGED
@@ -1,82 +1,100 @@
|
|
1 |
.new-wtlwp-form {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
}
|
7 |
|
8 |
.wtlwp-form-input {
|
9 |
-
|
10 |
}
|
11 |
|
12 |
.widefat .wtlwp-status {
|
13 |
-
|
14 |
}
|
15 |
|
16 |
.wtlwp-status-active {
|
17 |
-
|
18 |
}
|
19 |
|
20 |
.wtlwp-status-expired {
|
21 |
-
|
22 |
}
|
23 |
|
24 |
.wtlwp-status:after {
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
}
|
36 |
|
37 |
.wtlwp-status-active:after {
|
38 |
-
|
39 |
-
|
40 |
}
|
41 |
|
42 |
.wtlwp-status-expired:after {
|
43 |
-
|
44 |
-
|
45 |
}
|
46 |
|
47 |
.cancel-new-login-form {
|
48 |
-
|
49 |
}
|
50 |
|
51 |
.wtlwp-wide-input {
|
52 |
-
|
53 |
}
|
54 |
|
55 |
.generated-wtlwp-login-link {
|
56 |
-
|
57 |
-
|
58 |
}
|
59 |
|
60 |
.wtlwp-form-row {
|
61 |
-
|
62 |
}
|
63 |
|
64 |
.wtlwp-form-submit-button {
|
65 |
-
|
66 |
}
|
67 |
|
68 |
.wtlwp-user-login {
|
69 |
-
|
70 |
}
|
71 |
|
72 |
.wtlwp-copy-to-clipboard, .wtlwp-click-to-copy-btn {
|
73 |
-
|
74 |
}
|
75 |
|
76 |
.wtlwp-copy-to-clipboard:hover {
|
77 |
-
|
78 |
}
|
79 |
|
80 |
.copied-text-message {
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
1 |
.new-wtlwp-form {
|
2 |
+
border: 1px solid;
|
3 |
+
padding: 10px;
|
4 |
+
background-color: white;
|
5 |
+
display: none;
|
6 |
}
|
7 |
|
8 |
.wtlwp-form-input {
|
9 |
+
width: 300px !important;
|
10 |
}
|
11 |
|
12 |
.widefat .wtlwp-status {
|
13 |
+
width: 40px;
|
14 |
}
|
15 |
|
16 |
.wtlwp-status-active {
|
17 |
+
color: #008000 !important;
|
18 |
}
|
19 |
|
20 |
.wtlwp-status-expired {
|
21 |
+
color: #FF0000 !important;
|
22 |
}
|
23 |
|
24 |
.wtlwp-status:after {
|
25 |
+
border-radius: 32px;
|
26 |
+
color: #fff;
|
27 |
+
display: block;
|
28 |
+
font-size: 11px;
|
29 |
+
font-weight: bold;
|
30 |
+
height: 16px;
|
31 |
+
line-height: 17px;
|
32 |
+
margin-left: 8px;
|
33 |
+
text-align: center;
|
34 |
+
width: 16px;
|
35 |
}
|
36 |
|
37 |
.wtlwp-status-active:after {
|
38 |
+
background: #008000 none repeat scroll 0 0;
|
39 |
+
content: "";
|
40 |
}
|
41 |
|
42 |
.wtlwp-status-expired:after {
|
43 |
+
background: #FF0000 none repeat scroll 0 0;
|
44 |
+
content: "";
|
45 |
}
|
46 |
|
47 |
.cancel-new-login-form {
|
48 |
+
cursor: pointer;
|
49 |
}
|
50 |
|
51 |
.wtlwp-wide-input {
|
52 |
+
width: 60%;
|
53 |
}
|
54 |
|
55 |
.generated-wtlwp-login-link {
|
56 |
+
border: 1px solid;
|
57 |
+
padding: 10px 10px 10px 10px;
|
58 |
}
|
59 |
|
60 |
.wtlwp-form-row {
|
61 |
+
padding-left: 20px !important;
|
62 |
}
|
63 |
|
64 |
.wtlwp-form-submit-button {
|
65 |
+
width: 115px;
|
66 |
}
|
67 |
|
68 |
.wtlwp-user-login {
|
69 |
+
font-size: 12px;
|
70 |
}
|
71 |
|
72 |
.wtlwp-copy-to-clipboard, .wtlwp-click-to-copy-btn {
|
73 |
+
cursor: pointer;
|
74 |
}
|
75 |
|
76 |
.wtlwp-copy-to-clipboard:hover {
|
77 |
+
color: #0073aa;
|
78 |
}
|
79 |
|
80 |
.copied-text-message {
|
81 |
+
padding: 20px;
|
82 |
+
}
|
83 |
+
|
84 |
+
.wtlp-role-radio, .wtlp-role-checkbox {
|
85 |
+
text-align: center;
|
86 |
+
padding-top: 10px;
|
87 |
+
}
|
88 |
+
|
89 |
+
.tlwp-role-name {
|
90 |
+
padding-top: 10px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.visible-roles-dropdown {
|
94 |
+
min-height: 100px !important;
|
95 |
+
width: 200px;
|
96 |
+
}
|
97 |
+
|
98 |
+
.default-role-dropdown {
|
99 |
+
width: 200px;
|
100 |
}
|
admin/js/wp-temporary-login-without-password-admin.js
CHANGED
@@ -3,7 +3,6 @@
|
|
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 |
});
|
@@ -62,4 +61,5 @@
|
|
62 |
});
|
63 |
|
64 |
});
|
|
|
65 |
})(jQuery);
|
3 |
|
4 |
jQuery(document).ready(function () {
|
5 |
|
|
|
6 |
jQuery('#add-new-wtlwp-form-button').click(function () {
|
7 |
jQuery('#new-wtlwp-form').show();
|
8 |
});
|
61 |
});
|
62 |
|
63 |
});
|
64 |
+
|
65 |
})(jQuery);
|
includes/class-wp-temporary-login-without-password-activator.php
CHANGED
@@ -3,6 +3,14 @@
|
|
3 |
class Wp_Temporary_Login_Without_Password_Activator {
|
4 |
|
5 |
public static function activate() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
$temporary_logins_data = get_option( 'temporary_logins_data', array() );
|
8 |
|
@@ -19,6 +27,8 @@ class Wp_Temporary_Login_Without_Password_Activator {
|
|
19 |
|
20 |
// Empty set
|
21 |
update_option( 'temporary_logins_data', array(), $add );
|
|
|
|
|
22 |
}
|
23 |
|
24 |
}
|
3 |
class Wp_Temporary_Login_Without_Password_Activator {
|
4 |
|
5 |
public static function activate() {
|
6 |
+
/**
|
7 |
+
* Process
|
8 |
+
*
|
9 |
+
* - Get the previously added temporary logins data from temporary_logins_data option if available
|
10 |
+
* - Update user role for Temporary User if user exists into the system
|
11 |
+
* - Set temporary_logins_data option as empty
|
12 |
+
* - Set activation timestamp
|
13 |
+
*/
|
14 |
|
15 |
$temporary_logins_data = get_option( 'temporary_logins_data', array() );
|
16 |
|
27 |
|
28 |
// Empty set
|
29 |
update_option( 'temporary_logins_data', array(), $add );
|
30 |
+
update_option( 'tlwp_plugin_activation_time', time(), $add );
|
31 |
+
|
32 |
}
|
33 |
|
34 |
}
|
includes/class-wp-temporary-login-without-password-common.php
CHANGED
@@ -46,7 +46,7 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
46 |
public static function create_new_user( $data ) {
|
47 |
|
48 |
if ( false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
49 |
-
return;
|
50 |
}
|
51 |
|
52 |
$expiry_option = ! empty( $data['expiry'] ) ? $data['expiry'] : 'day';
|
@@ -63,7 +63,7 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
63 |
'last_name' => $last_name,
|
64 |
'user_login' => $username,
|
65 |
'user_pass' => $password,
|
66 |
-
'user_email' => sanitize_email( $email
|
67 |
'role' => $role,
|
68 |
);
|
69 |
|
@@ -97,7 +97,7 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
97 |
/**
|
98 |
* get the expiry duration
|
99 |
*
|
100 |
-
* @param
|
101 |
*
|
102 |
* @return boolean|array
|
103 |
*/
|
@@ -118,7 +118,9 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
118 |
} elseif ( isset( $expiry_duration[ $key ] ) ) {
|
119 |
return $expiry_duration[ $key ];
|
120 |
} else {
|
121 |
-
return
|
|
|
|
|
122 |
}
|
123 |
|
124 |
}
|
@@ -216,11 +218,12 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
216 |
|
217 |
$users = new WP_User_Query( $args );
|
218 |
|
219 |
-
|
|
|
220 |
return false;
|
221 |
}
|
222 |
|
223 |
-
return $
|
224 |
|
225 |
}
|
226 |
|
@@ -329,8 +332,7 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
329 |
|
330 |
}
|
331 |
|
332 |
-
public static function get_valid_user_based_on_wtlwp_token( $token = '', $
|
333 |
-
$users_data = array();
|
334 |
if ( empty( $token ) ) {
|
335 |
return false;
|
336 |
}
|
@@ -351,11 +353,11 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
351 |
|
352 |
$users = new WP_User_Query( $args );
|
353 |
|
354 |
-
|
|
|
355 |
return false;
|
356 |
}
|
357 |
|
358 |
-
$users_data = $users->results;
|
359 |
foreach ( $users_data as $key => $user ) {
|
360 |
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
361 |
if ( $expire <= self::get_current_gmt_timestamp() ) {
|
@@ -370,7 +372,7 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
370 |
/**
|
371 |
* Checks whether user is valid temporary user
|
372 |
*
|
373 |
-
* @param int
|
374 |
* @param bool $check_expiry
|
375 |
*
|
376 |
* @return bool
|
@@ -395,14 +397,14 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
395 |
* Get temporary login manage url
|
396 |
*
|
397 |
* @param $user_id
|
398 |
-
* @param string
|
399 |
*
|
400 |
-
* @return string
|
401 |
*/
|
402 |
public static function get_manage_login_url( $user_id, $action = '' ) {
|
403 |
|
404 |
if ( empty( $user_id ) || empty( $action ) ) {
|
405 |
-
return;
|
406 |
}
|
407 |
|
408 |
$base_url = menu_page_url( 'wp-temporary-login-without-password', false );
|
@@ -446,22 +448,22 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
446 |
*
|
447 |
* @param $user_id
|
448 |
*
|
449 |
-
* @return string
|
450 |
*/
|
451 |
public static function get_login_url( $user_id ) {
|
452 |
|
453 |
if ( empty( $user_id ) ) {
|
454 |
-
return;
|
455 |
}
|
456 |
|
457 |
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
458 |
if ( ! $is_valid_temporary_login ) {
|
459 |
-
return;
|
460 |
}
|
461 |
|
462 |
$wtlwp_token = get_user_meta( $user_id, '_wtlwp_token', true );
|
463 |
if ( empty( $wtlwp_token ) ) {
|
464 |
-
return;
|
465 |
}
|
466 |
|
467 |
$login_url = add_query_arg( 'wtlwp_token', $wtlwp_token, trailingslashit( admin_url() ) );
|
@@ -473,20 +475,20 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
473 |
/**
|
474 |
* Manage temporary logins
|
475 |
*
|
476 |
-
* @param int
|
477 |
* @param string $action
|
478 |
*
|
479 |
-
* @return bool
|
480 |
*/
|
481 |
public static function manage_login( $user_id = 0, $action = '' ) {
|
482 |
|
483 |
if ( empty( $user_id ) || empty( $action ) ) {
|
484 |
-
return;
|
485 |
}
|
486 |
|
487 |
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
488 |
if ( ! $is_valid_temporary_login ) {
|
489 |
-
return;
|
490 |
}
|
491 |
|
492 |
$manage_login = false;
|
@@ -507,10 +509,10 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
507 |
/**
|
508 |
* Get the redable time elapsed string
|
509 |
*
|
510 |
-
* @param int
|
511 |
* @param bool $ago
|
512 |
*
|
513 |
-
* @return string
|
514 |
*/
|
515 |
public static function time_elapsed_string( $time, $ago = false ) {
|
516 |
|
@@ -556,12 +558,14 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
556 |
}
|
557 |
}
|
558 |
|
|
|
|
|
559 |
}
|
560 |
|
561 |
/**
|
562 |
* Get all pages which needs to be blocked for temporary users
|
563 |
*
|
564 |
-
* @return array
|
565 |
*/
|
566 |
public static function get_blocked_pages() {
|
567 |
$blocked_pages = array( 'wp-temporary-login-without-password', 'user-new.php', 'user-edit.php', 'profile.php' );
|
@@ -581,11 +585,65 @@ class Wp_Temporary_Login_Without_Password_Common {
|
|
581 |
if ( count( $temporary_logins ) > 0 ) {
|
582 |
foreach ( $temporary_logins as $user ) {
|
583 |
if ( $user instanceof WP_User ) {
|
584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
}
|
586 |
}
|
587 |
}
|
588 |
|
|
|
589 |
}
|
590 |
|
591 |
}
|
46 |
public static function create_new_user( $data ) {
|
47 |
|
48 |
if ( false === Wp_Temporary_Login_Without_Password_Common::can_manage_wtlwp() ) {
|
49 |
+
return 0;
|
50 |
}
|
51 |
|
52 |
$expiry_option = ! empty( $data['expiry'] ) ? $data['expiry'] : 'day';
|
63 |
'last_name' => $last_name,
|
64 |
'user_login' => $username,
|
65 |
'user_pass' => $password,
|
66 |
+
'user_email' => sanitize_email( $email ),
|
67 |
'role' => $role,
|
68 |
);
|
69 |
|
97 |
/**
|
98 |
* get the expiry duration
|
99 |
*
|
100 |
+
* @param string $key
|
101 |
*
|
102 |
* @return boolean|array
|
103 |
*/
|
118 |
} elseif ( isset( $expiry_duration[ $key ] ) ) {
|
119 |
return $expiry_duration[ $key ];
|
120 |
} else {
|
121 |
+
return array(
|
122 |
+
'no_option_found' => __( 'No Option Found', 'temporary-login-without-password' ),
|
123 |
+
);
|
124 |
}
|
125 |
|
126 |
}
|
218 |
|
219 |
$users = new WP_User_Query( $args );
|
220 |
|
221 |
+
$users_data = $users->get_results();
|
222 |
+
if ( ! ( $users_data ) ) {
|
223 |
return false;
|
224 |
}
|
225 |
|
226 |
+
return $users_data;
|
227 |
|
228 |
}
|
229 |
|
332 |
|
333 |
}
|
334 |
|
335 |
+
public static function get_valid_user_based_on_wtlwp_token( $token = '', $fields = 'all' ) {
|
|
|
336 |
if ( empty( $token ) ) {
|
337 |
return false;
|
338 |
}
|
353 |
|
354 |
$users = new WP_User_Query( $args );
|
355 |
|
356 |
+
$users_data = $users->get_results();
|
357 |
+
if ( empty( $users_data ) ) {
|
358 |
return false;
|
359 |
}
|
360 |
|
|
|
361 |
foreach ( $users_data as $key => $user ) {
|
362 |
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
363 |
if ( $expire <= self::get_current_gmt_timestamp() ) {
|
372 |
/**
|
373 |
* Checks whether user is valid temporary user
|
374 |
*
|
375 |
+
* @param int $user_id
|
376 |
* @param bool $check_expiry
|
377 |
*
|
378 |
* @return bool
|
397 |
* Get temporary login manage url
|
398 |
*
|
399 |
* @param $user_id
|
400 |
+
* @param string $action
|
401 |
*
|
402 |
+
* @return string
|
403 |
*/
|
404 |
public static function get_manage_login_url( $user_id, $action = '' ) {
|
405 |
|
406 |
if ( empty( $user_id ) || empty( $action ) ) {
|
407 |
+
return '';
|
408 |
}
|
409 |
|
410 |
$base_url = menu_page_url( 'wp-temporary-login-without-password', false );
|
448 |
*
|
449 |
* @param $user_id
|
450 |
*
|
451 |
+
* @return string
|
452 |
*/
|
453 |
public static function get_login_url( $user_id ) {
|
454 |
|
455 |
if ( empty( $user_id ) ) {
|
456 |
+
return '';
|
457 |
}
|
458 |
|
459 |
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
460 |
if ( ! $is_valid_temporary_login ) {
|
461 |
+
return '';
|
462 |
}
|
463 |
|
464 |
$wtlwp_token = get_user_meta( $user_id, '_wtlwp_token', true );
|
465 |
if ( empty( $wtlwp_token ) ) {
|
466 |
+
return '';
|
467 |
}
|
468 |
|
469 |
$login_url = add_query_arg( 'wtlwp_token', $wtlwp_token, trailingslashit( admin_url() ) );
|
475 |
/**
|
476 |
* Manage temporary logins
|
477 |
*
|
478 |
+
* @param int $user_id
|
479 |
* @param string $action
|
480 |
*
|
481 |
+
* @return bool
|
482 |
*/
|
483 |
public static function manage_login( $user_id = 0, $action = '' ) {
|
484 |
|
485 |
if ( empty( $user_id ) || empty( $action ) ) {
|
486 |
+
return false;
|
487 |
}
|
488 |
|
489 |
$is_valid_temporary_login = self::is_valid_temporary_login( $user_id, false );
|
490 |
if ( ! $is_valid_temporary_login ) {
|
491 |
+
return false;
|
492 |
}
|
493 |
|
494 |
$manage_login = false;
|
509 |
/**
|
510 |
* Get the redable time elapsed string
|
511 |
*
|
512 |
+
* @param int $time
|
513 |
* @param bool $ago
|
514 |
*
|
515 |
+
* @return string
|
516 |
*/
|
517 |
public static function time_elapsed_string( $time, $ago = false ) {
|
518 |
|
558 |
}
|
559 |
}
|
560 |
|
561 |
+
return __( 'Expired', 'temporary-login-without-password' );
|
562 |
+
|
563 |
}
|
564 |
|
565 |
/**
|
566 |
* Get all pages which needs to be blocked for temporary users
|
567 |
*
|
568 |
+
* @return array
|
569 |
*/
|
570 |
public static function get_blocked_pages() {
|
571 |
$blocked_pages = array( 'wp-temporary-login-without-password', 'user-new.php', 'user-edit.php', 'profile.php' );
|
585 |
if ( count( $temporary_logins ) > 0 ) {
|
586 |
foreach ( $temporary_logins as $user ) {
|
587 |
if ( $user instanceof WP_User ) {
|
588 |
+
wp_delete_user( $user->ID ); // Delete User
|
589 |
+
}
|
590 |
+
}
|
591 |
+
}
|
592 |
+
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
* Print out option html elements for multi role selectors.
|
597 |
+
*
|
598 |
+
* @since 1.5.2
|
599 |
+
*
|
600 |
+
* @param string $selected Slug for the role that should be already selected.
|
601 |
+
*/
|
602 |
+
public static function tlwp_multi_select_dropdown_roles( $selected_roles = array() ) {
|
603 |
+
$r = '';
|
604 |
+
|
605 |
+
$editable_roles = array_reverse( get_editable_roles() );
|
606 |
+
|
607 |
+
foreach ( $editable_roles as $role => $details ) {
|
608 |
+
$name = translate_user_role( $details['name'] );
|
609 |
+
// preselect specified role
|
610 |
+
if ( count($selected_roles ) > 0 && in_array( $role, $selected_roles ) ) {
|
611 |
+
$r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
|
612 |
+
} else {
|
613 |
+
$r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
echo $r;
|
618 |
+
}
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Print out option html elements for role selectors.
|
622 |
+
*
|
623 |
+
* @since 1.5.2
|
624 |
+
*
|
625 |
+
* @param string $selected Slug for the role that should be already selected.
|
626 |
+
*/
|
627 |
+
public static function tlwp_dropdown_roles( $visible_roles = array(), $selected = '' ) {
|
628 |
+
$r = '';
|
629 |
+
|
630 |
+
$editable_roles = array_reverse( get_editable_roles() );
|
631 |
+
|
632 |
+
$visible_roles = ! empty( $visible_roles ) ? $visible_roles : array_keys( $editable_roles );
|
633 |
+
|
634 |
+
foreach ( $editable_roles as $role => $details ) {
|
635 |
+
if ( in_array( $role, $visible_roles ) ) {
|
636 |
+
$name = translate_user_role( $details['name'] );
|
637 |
+
// preselect specified role
|
638 |
+
if ( $selected == $role ) {
|
639 |
+
$r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
|
640 |
+
} else {
|
641 |
+
$r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
642 |
}
|
643 |
}
|
644 |
}
|
645 |
|
646 |
+
echo $r;
|
647 |
}
|
648 |
|
649 |
}
|
includes/class-wp-temporary-login-without-password-deactivator.php
CHANGED
@@ -4,6 +4,13 @@ class Wp_Temporary_Login_Without_Password_Deactivator {
|
|
4 |
|
5 |
public static function deactivate() {
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
8 |
|
9 |
$temporary_logins_data = array();
|
@@ -11,8 +18,8 @@ class Wp_Temporary_Login_Without_Password_Deactivator {
|
|
11 |
foreach ( $temporary_logins as $user ) {
|
12 |
if ( $user instanceof WP_User ) {
|
13 |
$temporary_logins_data[ $user->ID ] = $user->roles[0];
|
14 |
-
|
15 |
-
'ID'
|
16 |
'role' => '',
|
17 |
) ); // Downgrade role to none. So, user won't be able to login
|
18 |
}
|
@@ -20,6 +27,7 @@ class Wp_Temporary_Login_Without_Password_Deactivator {
|
|
20 |
}
|
21 |
|
22 |
$add = 'yes';
|
|
|
23 |
update_option( 'temporary_logins_data', $temporary_logins_data, $add );
|
24 |
}
|
25 |
|
4 |
|
5 |
public static function deactivate() {
|
6 |
|
7 |
+
/**
|
8 |
+
* Steps
|
9 |
+
*
|
10 |
+
* - Get all temporary users data
|
11 |
+
* - Set role to '' (null) for temporary users
|
12 |
+
* - Backup all temporary users data into temporary_logins_data option
|
13 |
+
*/
|
14 |
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
15 |
|
16 |
$temporary_logins_data = array();
|
18 |
foreach ( $temporary_logins as $user ) {
|
19 |
if ( $user instanceof WP_User ) {
|
20 |
$temporary_logins_data[ $user->ID ] = $user->roles[0];
|
21 |
+
wp_update_user( array(
|
22 |
+
'ID' => $user->ID,
|
23 |
'role' => '',
|
24 |
) ); // Downgrade role to none. So, user won't be able to login
|
25 |
}
|
27 |
}
|
28 |
|
29 |
$add = 'yes';
|
30 |
+
// Backup temporary users's data into temporary_logins_data option for future use.
|
31 |
update_option( 'temporary_logins_data', $temporary_logins_data, $add );
|
32 |
}
|
33 |
|
includes/class-wp-temporary-login-without-password-layout.php
CHANGED
@@ -2,6 +2,13 @@
|
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Layout {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public static function prepare_header_footer_row() {
|
6 |
|
7 |
$row = '';
|
@@ -15,6 +22,13 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
15 |
return $row;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public static function prepare_empty_user_row() {
|
19 |
|
20 |
$row = '';
|
@@ -28,15 +42,20 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
28 |
return $row;
|
29 |
}
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
global $wpdb;
|
33 |
if ( is_numeric( $user ) && ! is_object( $user ) ) {
|
34 |
$user = get_user_by( 'id', $user );
|
35 |
}
|
36 |
|
37 |
-
$create = get_user_meta( $user->ID, '_wtlwp_created', true );
|
38 |
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
39 |
-
$token = get_user_meta( $user->ID, '_wtlwp_token', true );
|
40 |
$last_login_time = get_user_meta( $user->ID, '_wtlwp_last_login', true );
|
41 |
|
42 |
$last_login_str = __( 'Not yet logged in', 'temporary-login-without-password' );
|
@@ -49,7 +68,7 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
49 |
$wtlwp_status = 'Expired';
|
50 |
}
|
51 |
|
52 |
-
if ( is_super_admin( $user->ID ) ) {
|
53 |
$user_role = __( 'Super Admin', 'temporary-login-without-password' );
|
54 |
} else {
|
55 |
$capabilities = $user->{$wpdb->prefix . 'capabilities'};
|
@@ -97,6 +116,14 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
97 |
return $row;
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
public static function prepare_row_actions( $user, $wtlwp_status ) {
|
101 |
|
102 |
$action_row = '<div class="actions">';
|
@@ -113,8 +140,8 @@ class Wp_Temporary_Login_Without_Password_Layout {
|
|
113 |
$action_row .= '<span class="disable"><a title="' . __( 'Disable', 'temporary-login-without-password' ) . '" href="' . $disable_login_url . '"><span class="dashicons dashicons-unlock"></span></a></span>';
|
114 |
}
|
115 |
|
116 |
-
$action_row .= '<span class="
|
117 |
-
$action_row .= '<span class="
|
118 |
$action_row .= '<span id="copied-text-' . $user->ID . '" class="copied-text-message"></span>';
|
119 |
$action_row .= '</div>';
|
120 |
|
2 |
|
3 |
class Wp_Temporary_Login_Without_Password_Layout {
|
4 |
|
5 |
+
/**
|
6 |
+
* Create footer headings
|
7 |
+
*
|
8 |
+
* @since 1.0
|
9 |
+
*
|
10 |
+
* @return string
|
11 |
+
*/
|
12 |
public static function prepare_header_footer_row() {
|
13 |
|
14 |
$row = '';
|
22 |
return $row;
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* Prepare empty user row
|
27 |
+
*
|
28 |
+
* @since 1.0
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
public static function prepare_empty_user_row() {
|
33 |
|
34 |
$row = '';
|
42 |
return $row;
|
43 |
}
|
44 |
|
45 |
+
/**
|
46 |
+
* @param WP_User|int $user
|
47 |
+
*
|
48 |
+
* @since 1.0
|
49 |
+
*
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public static function prepare_single_user_row( $user = OBJECT ) {
|
53 |
global $wpdb;
|
54 |
if ( is_numeric( $user ) && ! is_object( $user ) ) {
|
55 |
$user = get_user_by( 'id', $user );
|
56 |
}
|
57 |
|
|
|
58 |
$expire = get_user_meta( $user->ID, '_wtlwp_expire', true );
|
|
|
59 |
$last_login_time = get_user_meta( $user->ID, '_wtlwp_last_login', true );
|
60 |
|
61 |
$last_login_str = __( 'Not yet logged in', 'temporary-login-without-password' );
|
68 |
$wtlwp_status = 'Expired';
|
69 |
}
|
70 |
|
71 |
+
if ( is_multisite() && is_super_admin( $user->ID ) ) {
|
72 |
$user_role = __( 'Super Admin', 'temporary-login-without-password' );
|
73 |
} else {
|
74 |
$capabilities = $user->{$wpdb->prefix . 'capabilities'};
|
116 |
return $row;
|
117 |
}
|
118 |
|
119 |
+
/**
|
120 |
+
* @param WP_User $user
|
121 |
+
* @param string $wtlwp_status
|
122 |
+
*
|
123 |
+
* @since 1.0
|
124 |
+
*
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
public static function prepare_row_actions( $user, $wtlwp_status ) {
|
128 |
|
129 |
$action_row = '<div class="actions">';
|
140 |
$action_row .= '<span class="disable"><a title="' . __( 'Disable', 'temporary-login-without-password' ) . '" href="' . $disable_login_url . '"><span class="dashicons dashicons-unlock"></span></a></span>';
|
141 |
}
|
142 |
|
143 |
+
$action_row .= '<span class="delete"><a title="' . __( 'Delete', 'temporary-login-without-password' ) . '" href="' . $delete_login_url . '"><span class="dashicons dashicons-no"></span></a></span>';
|
144 |
+
$action_row .= '<span class="copy"><span id="text-' . $user->ID . '" class="dashicons dashicons-admin-links wtlwp-copy-to-clipboard" title="' . __( 'Copy login link', 'temporary-login-without-password' ) . '" data-clipboard-text="' . Wp_Temporary_Login_Without_Password_Common::get_login_url( $user->ID ) . '"></span></span>';
|
145 |
$action_row .= '<span id="copied-text-' . $user->ID . '" class="copied-text-message"></span>';
|
146 |
$action_row .= '</div>';
|
147 |
|
includes/class-wp-temporary-login-without-password-loader.php
CHANGED
@@ -8,19 +8,54 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
8 |
protected $actions;
|
9 |
protected $filters;
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
public function __construct() {
|
12 |
$this->actions = array();
|
13 |
$this->filters = array();
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
17 |
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
21 |
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
25 |
|
26 |
$hooks[] = array(
|
@@ -34,19 +69,23 @@ class Wp_Temporary_Login_Without_Password_Loader {
|
|
34 |
return $hooks;
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
37 |
public function run() {
|
38 |
|
39 |
foreach ( $this->filters as $hook ) {
|
40 |
add_filter( $hook['hook'], array(
|
41 |
$hook['component'],
|
42 |
-
$hook['callback']
|
43 |
), $hook['priority'], $hook['accepted_args'] );
|
44 |
}
|
45 |
|
46 |
foreach ( $this->actions as $hook ) {
|
47 |
add_action( $hook['hook'], array(
|
48 |
$hook['component'],
|
49 |
-
$hook['callback']
|
50 |
), $hook['priority'], $hook['accepted_args'] );
|
51 |
}
|
52 |
}
|
8 |
protected $actions;
|
9 |
protected $filters;
|
10 |
|
11 |
+
/**
|
12 |
+
* Wp_Temporary_Login_Without_Password_Loader constructor.
|
13 |
+
*
|
14 |
+
* @since 1.0
|
15 |
+
*/
|
16 |
public function __construct() {
|
17 |
$this->actions = array();
|
18 |
$this->filters = array();
|
19 |
}
|
20 |
|
21 |
+
/**
|
22 |
+
* @param $hook
|
23 |
+
* @param $component
|
24 |
+
* @param $callback
|
25 |
+
* @param int $priority
|
26 |
+
* @param int $accepted_args
|
27 |
+
*
|
28 |
+
* @since 1.0
|
29 |
+
*/
|
30 |
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
31 |
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* @param $hook
|
36 |
+
* @param $component
|
37 |
+
* @param $callback
|
38 |
+
* @param int $priority
|
39 |
+
* @param int $accepted_args
|
40 |
+
*
|
41 |
+
* @since 1.0
|
42 |
+
*/
|
43 |
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
44 |
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* @param $hooks
|
49 |
+
* @param $hook
|
50 |
+
* @param $component
|
51 |
+
* @param $callback
|
52 |
+
* @param $priority
|
53 |
+
* @param $accepted_args
|
54 |
+
*
|
55 |
+
* @since 1.0
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
60 |
|
61 |
$hooks[] = array(
|
69 |
return $hooks;
|
70 |
}
|
71 |
|
72 |
+
/**
|
73 |
+
*
|
74 |
+
* @since 1.0
|
75 |
+
*/
|
76 |
public function run() {
|
77 |
|
78 |
foreach ( $this->filters as $hook ) {
|
79 |
add_filter( $hook['hook'], array(
|
80 |
$hook['component'],
|
81 |
+
$hook['callback'],
|
82 |
), $hook['priority'], $hook['accepted_args'] );
|
83 |
}
|
84 |
|
85 |
foreach ( $this->actions as $hook ) {
|
86 |
add_action( $hook['hook'], array(
|
87 |
$hook['component'],
|
88 |
+
$hook['callback'],
|
89 |
), $hook['priority'], $hook['accepted_args'] );
|
90 |
}
|
91 |
}
|
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.5.
|
13 |
|
14 |
$this->load_dependencies();
|
15 |
$this->set_locale();
|
@@ -17,12 +17,6 @@ class Wp_Temporary_Login_Without_Password {
|
|
17 |
$this->define_public_hooks();
|
18 |
}
|
19 |
|
20 |
-
public function define_constant( $name, $value ) {
|
21 |
-
if ( ! defined( $name ) ) {
|
22 |
-
define( $name, $value );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
private function load_dependencies() {
|
27 |
|
28 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-temporary-login-without-password-loader.php';
|
@@ -54,7 +48,6 @@ class Wp_Temporary_Login_Without_Password {
|
|
54 |
$this->loader->add_action( 'network_admin_menu', $plugin_admin, 'admin_menu' );
|
55 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'create_user' );
|
56 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'update_tlwp_settings' );
|
57 |
-
$this->loader->add_action( 'admin_init', $plugin_admin, 'delete_user' );
|
58 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
|
59 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'tlwp_ask_user_for_review' );
|
60 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
|
9 |
public function __construct() {
|
10 |
|
11 |
$this->plugin_name = 'temporary-login-without-password';
|
12 |
+
$this->version = '1.5.2';
|
13 |
|
14 |
$this->load_dependencies();
|
15 |
$this->set_locale();
|
17 |
$this->define_public_hooks();
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
private function load_dependencies() {
|
21 |
|
22 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-temporary-login-without-password-loader.php';
|
48 |
$this->loader->add_action( 'network_admin_menu', $plugin_admin, 'admin_menu' );
|
49 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'create_user' );
|
50 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'update_tlwp_settings' );
|
|
|
51 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
|
52 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'tlwp_ask_user_for_review' );
|
53 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
|
index.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Silence is golden.
|
4 |
-
*
|
5 |
* @since 1.0
|
6 |
*/
|
1 |
<?php
|
2 |
/**
|
3 |
* Silence is golden.
|
4 |
+
*
|
5 |
* @since 1.0
|
6 |
*/
|
languages/temporary-login-without-password.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2018-01-
|
7 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
8 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
9 |
"Language-Team: \n"
|
@@ -14,168 +14,173 @@ msgstr ""
|
|
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:
|
18 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
19 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
76 |
msgid "Settings have been updated successfully"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
80 |
msgid "Success!"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
84 |
#, php-format
|
85 |
msgid ""
|
86 |
"If you like <strong>Temporary Login Without Password</strong> plugin, please "
|
87 |
"leave us a %s rating. A huge thanks in advance!"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
91 |
msgid "Thank You :) "
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:
|
95 |
#, php-format
|
96 |
msgid "Thank you for using %s."
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
100 |
msgid "Three Days"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
104 |
msgid "One Day"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
108 |
msgid "Three Hours"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
112 |
msgid "One Hour"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
116 |
msgid "One Week"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
120 |
msgid "One Month"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
124 |
msgid "Custom Date"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:
|
|
|
|
|
|
|
|
|
|
|
128 |
msgid "Expired"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
132 |
msgid "Users"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
136 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
137 |
msgid "Role"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
141 |
msgid "Last Logged In"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
145 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
146 |
msgid "Expiry"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
150 |
msgid "Actions"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
154 |
msgid "You have not created any temporary logins yet."
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
158 |
msgid "Not yet logged in"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
162 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
163 |
msgid "Super Admin"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
167 |
msgid "Reactivate for one day"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
171 |
msgid "Disable"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
175 |
msgid "Delete"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:
|
179 |
msgid "Copy login link"
|
180 |
msgstr ""
|
181 |
|
@@ -187,23 +192,23 @@ msgstr ""
|
|
187 |
msgid "Authentication failed"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:
|
191 |
msgid "You don't have permission to access this page"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:
|
195 |
msgid "Create New"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:
|
199 |
msgid "Here's a temporary login link"
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:
|
203 |
msgid "Click To Copy"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:
|
207 |
msgid ""
|
208 |
"User can directly login to wordpress admin panel without username and "
|
209 |
"password by opening this link."
|
@@ -213,28 +218,32 @@ msgstr ""
|
|
213 |
msgid "Create a new Temporary Login"
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
217 |
msgid "Email*"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
221 |
msgid "First Name"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
225 |
msgid "Last Name"
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
229 |
-
|
|
|
|
|
|
|
|
|
230 |
msgid "Submit"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
234 |
msgid "or"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:
|
238 |
msgid "Cancel"
|
239 |
msgstr ""
|
240 |
|
@@ -242,7 +251,15 @@ msgstr ""
|
|
242 |
msgid "Temporary Login Settings"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/temporary_logins_settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
msgid "Default Role"
|
247 |
msgstr ""
|
248 |
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: PACKAGE VERSION\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2018-01-29 07:17+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"
|
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:80
|
18 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:80
|
19 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:12
|
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:363
|
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:367
|
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:371
|
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:375
|
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:379
|
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:383
|
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:387
|
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:391
|
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:396
|
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:404
|
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:408
|
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:412
|
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:416
|
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:420
|
76 |
msgid "Settings have been updated successfully"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:424
|
80 |
msgid "Success!"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:480
|
84 |
#, php-format
|
85 |
msgid ""
|
86 |
"If you like <strong>Temporary Login Without Password</strong> plugin, please "
|
87 |
"leave us a %s rating. A huge thanks in advance!"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:480
|
91 |
msgid "Thank You :) "
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/admin/class-wp-temporary-login-without-password-admin.php:482
|
95 |
#, php-format
|
96 |
msgid "Thank you for using %s."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:107
|
100 |
msgid "Three Days"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:108
|
104 |
msgid "One Day"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:109
|
108 |
msgid "Three Hours"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:110
|
112 |
msgid "One Hour"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:111
|
116 |
msgid "One Week"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:112
|
120 |
msgid "One Month"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:113
|
124 |
msgid "Custom Date"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:121
|
128 |
+
msgid "No Option Found"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:524
|
132 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-common.php:559
|
133 |
msgid "Expired"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:16
|
137 |
msgid "Users"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:17
|
141 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:44
|
142 |
msgid "Role"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:18
|
146 |
msgid "Last Logged In"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:19
|
150 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:56
|
151 |
msgid "Expiry"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:20
|
155 |
msgid "Actions"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:38
|
159 |
msgid "You have not created any temporary logins yet."
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:61
|
163 |
msgid "Not yet logged in"
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:72
|
167 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:34
|
168 |
msgid "Super Admin"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:138
|
172 |
msgid "Reactivate for one day"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:140
|
176 |
msgid "Disable"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:143
|
180 |
msgid "Delete"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/includes/class-wp-temporary-login-without-password-layout.php:144
|
184 |
msgid "Copy login link"
|
185 |
msgstr ""
|
186 |
|
192 |
msgid "Authentication failed"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/public/class-wp-temporary-login-without-password-public.php:73
|
196 |
msgid "You don't have permission to access this page"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:13
|
200 |
msgid "Create New"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:25
|
204 |
msgid "Here's a temporary login link"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:28
|
208 |
msgid "Click To Copy"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/admin_settings.php:32
|
212 |
msgid ""
|
213 |
"User can directly login to wordpress admin panel without username and "
|
214 |
"password by opening this link."
|
218 |
msgid "Create a new Temporary Login"
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:6
|
222 |
msgid "Email*"
|
223 |
msgstr ""
|
224 |
|
225 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:15
|
226 |
msgid "First Name"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:24
|
230 |
msgid "Last Name"
|
231 |
msgstr ""
|
232 |
|
233 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:38
|
234 |
+
msgid "Grant this user super admin privileges for the Network."
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:76
|
238 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/temporary_logins_settings.php:30
|
239 |
msgid "Submit"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:76
|
243 |
msgid "or"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/new_login.php:77
|
247 |
msgid "Cancel"
|
248 |
msgstr ""
|
249 |
|
251 |
msgid "Temporary Login Settings"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/temporary_logins_settings.php:6
|
255 |
+
msgid "Visible Roles"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/temporary_logins_settings.php:7
|
259 |
+
msgid "select roles from which you want to create a temporary login"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: ../../../../../repositories/GitLab/store-apps/temporary-login-without-password/templates/temporary_logins_settings.php:18
|
263 |
msgid "Default Role"
|
264 |
msgstr ""
|
265 |
|
public/class-wp-temporary-login-without-password-public.php
CHANGED
@@ -28,8 +28,6 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
28 |
|
29 |
if ( ! is_user_logged_in() && ! empty( $_GET['wtlwp_token'] ) ) {
|
30 |
|
31 |
-
$error_messages = array();
|
32 |
-
|
33 |
$wtlwp_token = $_GET['wtlwp_token'];
|
34 |
$users = Wp_Temporary_Login_Without_Password_Common::get_valid_user_based_on_wtlwp_token( $wtlwp_token );
|
35 |
|
@@ -82,8 +80,8 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
82 |
/**
|
83 |
* Hooked to wp_authenticate_user filter to disable login for temporary user using username/email and password
|
84 |
*
|
85 |
-
* @param
|
86 |
-
* @param
|
87 |
*
|
88 |
* @return \WP_Error
|
89 |
*/
|
@@ -92,6 +90,8 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
92 |
if ( $user instanceof WP_User ) {
|
93 |
$check_expiry = false;
|
94 |
$is_valid_temporary_login = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user->ID, $check_expiry );
|
|
|
|
|
95 |
if ( $is_valid_temporary_login ) {
|
96 |
$user = new WP_Error( 'denied', __( "ERROR: User can't find." ) );
|
97 |
}
|
@@ -104,7 +104,7 @@ class Wp_Temporary_Login_Without_Password_Public {
|
|
104 |
* Hooked to allow_password_reset filter to disable reset password for temporary user
|
105 |
*
|
106 |
* @param boolean $allow
|
107 |
-
* @param
|
108 |
*
|
109 |
* @return boolean
|
110 |
*/
|
28 |
|
29 |
if ( ! is_user_logged_in() && ! empty( $_GET['wtlwp_token'] ) ) {
|
30 |
|
|
|
|
|
31 |
$wtlwp_token = $_GET['wtlwp_token'];
|
32 |
$users = Wp_Temporary_Login_Without_Password_Common::get_valid_user_based_on_wtlwp_token( $wtlwp_token );
|
33 |
|
80 |
/**
|
81 |
* Hooked to wp_authenticate_user filter to disable login for temporary user using username/email and password
|
82 |
*
|
83 |
+
* @param WP_User $user
|
84 |
+
* @param string $password
|
85 |
*
|
86 |
* @return \WP_Error
|
87 |
*/
|
90 |
if ( $user instanceof WP_User ) {
|
91 |
$check_expiry = false;
|
92 |
$is_valid_temporary_login = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $user->ID, $check_expiry );
|
93 |
+
|
94 |
+
// Is temporary user? Disable Login by throwing error.
|
95 |
if ( $is_valid_temporary_login ) {
|
96 |
$user = new WP_Error( 'denied', __( "ERROR: User can't find." ) );
|
97 |
}
|
104 |
* Hooked to allow_password_reset filter to disable reset password for temporary user
|
105 |
*
|
106 |
* @param boolean $allow
|
107 |
+
* @param int $user_id
|
108 |
*
|
109 |
* @return boolean
|
110 |
*/
|
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.9.
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,9 +18,11 @@ Using "Temporary Login Without Password" plugin you can create a self expiring a
|
|
18 |
|
19 |
You can choose when the login expires, as well as the role of the temporary account.
|
20 |
|
21 |
-
Really useful when you need to give admin access to a developer for support or for performing routine tasks.
|
22 |
|
23 |
-
|
|
|
|
|
24 |
|
25 |
|
26 |
**Spread The Word**
|
@@ -37,9 +39,15 @@ If you like Temporary Login Without Password, please leave a five star review on
|
|
37 |
|
38 |
1. Create a new temporary login.
|
39 |
2. List of all (Active/Expired) temporary logins.
|
|
|
40 |
|
41 |
== Changelog ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
= 1.5.1 [01-19-2018] =
|
44 |
|
45 |
- Fixed: Parse error: syntax error, unexpected ‘[‘ (PHP < 5.4)
|
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.9.2
|
7 |
+
Stable tag: 1.5.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
18 |
|
19 |
You can choose when the login expires, as well as the role of the temporary account.
|
20 |
|
21 |
+
Really useful when you need to give admin access to a developer for support or for performing routine tasks.
|
22 |
|
23 |
+
Read [this article](https://www.storeapps.org/create-secure-login-without-password-for-wordpress/) to know more about what's the Current Problem – Creating a Seperate Admin Login for Outsiders (Devs/ Guest bloggers) and how to avoid this pain, Top Benefits of using this plugin & Why and Who need Temporary Login links.
|
24 |
+
|
25 |
+
Use this plugin along with [WP Security Audit Log](https://wordpress.org/plugins/wp-security-audit-log/) plugin to track what the person does after loggin in.
|
26 |
|
27 |
|
28 |
**Spread The Word**
|
39 |
|
40 |
1. Create a new temporary login.
|
41 |
2. List of all (Active/Expired) temporary logins.
|
42 |
+
3. Temporary Login settings panel.
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 1.5.2 [01-29-2018] =
|
47 |
+
|
48 |
+
- Added: Now, admin can select roles from which they want to create a Tempoary Login.
|
49 |
+
- Fixed: Temporary User with 'administrator' role shows as a 'Super Admin' for WordPress single site installtion.
|
50 |
+
|
51 |
= 1.5.1 [01-19-2018] =
|
52 |
|
53 |
- Fixed: Parse error: syntax error, unexpected ‘[‘ (PHP < 5.4)
|
screenshots/screenshot-3.png
ADDED
Binary file
|
templates/admin_settings.php
CHANGED
@@ -1,56 +1,57 @@
|
|
1 |
<?php ?>
|
2 |
<h2 class="nav-tab-wrapper">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
</h2>
|
8 |
|
9 |
|
10 |
<?php if ( $active_tab == 'home' ) { ?>
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
<?php include WTLWP_PLUGIN_DIR . '/templates/new_login.php'; ?>
|
19 |
-
|
20 |
|
21 |
<?php if ( ! empty( $wtlwp_generated_url ) ) { ?>
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
if ( ! empty( $user_email ) ) {
|
33 |
echo __( sprintf( " <a href='mailto:%s'>Email</a> copied login link to user.", $user_email ), 'temporary-login-without-password' );
|
34 |
}
|
35 |
?>
|
36 |
-
|
37 |
|
38 |
-
|
39 |
<?php } ?>
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
<?php load_template( WTLWP_PLUGIN_DIR . '/templates/list_temporary_logins.php' ); ?>
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
<?php } elseif ( $active_tab == 'settings' ) { ?>
|
50 |
|
51 |
-
|
52 |
<?php include WTLWP_PLUGIN_DIR . '/templates/temporary_logins_settings.php' ?>
|
53 |
-
|
54 |
|
55 |
<?php }// End if().
|
56 |
?>
|
1 |
<?php ?>
|
2 |
<h2 class="nav-tab-wrapper">
|
3 |
+
<a href="<?php echo admin_url( 'users.php?page=wp-temporary-login-without-password&tab=home' ); ?>"
|
4 |
+
class="nav-tab <?php echo $active_tab == 'home' ? 'nav-tab-active' : ''; ?>">Temporary Logins</a>
|
5 |
+
<a href="<?php echo admin_url( 'users.php?page=wp-temporary-login-without-password&tab=settings' ); ?>"
|
6 |
+
class="nav-tab <?php echo $active_tab == 'settings' ? 'nav-tab-active' : ''; ?>">Settings</a>
|
7 |
</h2>
|
8 |
|
9 |
|
10 |
<?php if ( $active_tab == 'home' ) { ?>
|
11 |
+
<div class="wrap wtlwp-settings-wrap" id="temporary-logins">
|
12 |
+
<h2> <?php echo __( 'Temporary Logins', 'temporary-login-without-password' ); ?> <span class="page-title-action"
|
13 |
+
id="add-new-wtlwp-form-button"><?php _e( 'Create New', 'temporary-login-without-password' ); ?></span>
|
14 |
+
</h2>
|
15 |
+
<div class="wtlwp-settings">
|
16 |
+
<!-- Add New Form Start -->
|
17 |
+
<div class="wrap new-wtlwp-form" id="new-wtlwp-form">
|
18 |
<?php include WTLWP_PLUGIN_DIR . '/templates/new_login.php'; ?>
|
19 |
+
</div>
|
20 |
|
21 |
<?php if ( ! empty( $wtlwp_generated_url ) ) { ?>
|
22 |
|
23 |
+
<div class="wrap generated-wtlwp-login-link" id="generated-wtlwp-login-link">
|
24 |
+
<p>
|
25 |
+
<?php _e( "Here's a temporary login link", 'temporary-login-without-password' ); ?>
|
26 |
+
</p>
|
27 |
+
<input id="wtlwp-click-to-copy-btn" type="text" class="wtlwp-wide-input" value="<?php echo $wtlwp_generated_url; ?>">
|
28 |
+
<button class="wtlwp-click-to-copy-btn" data-clipboard-action="copy" data-clipboard-target="#wtlwp-click-to-copy-btn"><?php echo __( 'Click To Copy', 'temporary-login-without-password' ); ?></button>
|
29 |
+
<span id="copied-text-message-wtlwp-click-to-copy-btn"></span>
|
30 |
+
<p>
|
31 |
+
<?php
|
32 |
+
_e( 'User can directly login to wordpress admin panel without username and password by opening this link.', 'temporary-login-without-password' );
|
33 |
if ( ! empty( $user_email ) ) {
|
34 |
echo __( sprintf( " <a href='mailto:%s'>Email</a> copied login link to user.", $user_email ), 'temporary-login-without-password' );
|
35 |
}
|
36 |
?>
|
37 |
+
</p>
|
38 |
|
39 |
+
</div>
|
40 |
<?php } ?>
|
41 |
+
<!-- Add New Form End -->
|
42 |
|
43 |
+
<!-- List All Generated Logins Start -->
|
44 |
+
<div class="wrap list-wtlwp-logins" id="list-wtlwp-logins">
|
45 |
<?php load_template( WTLWP_PLUGIN_DIR . '/templates/list_temporary_logins.php' ); ?>
|
46 |
+
</div>
|
47 |
+
<!-- List All Generated Logins End -->
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
<?php } elseif ( $active_tab == 'settings' ) { ?>
|
51 |
|
52 |
+
<div class="wrap list-wtlwp-logins" id="wtlwp-logins-settings">
|
53 |
<?php include WTLWP_PLUGIN_DIR . '/templates/temporary_logins_settings.php' ?>
|
54 |
+
</div>
|
55 |
|
56 |
<?php }// End if().
|
57 |
?>
|
templates/list_temporary_logins.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<table class="wp-list-table widefat fixed striped users">
|
2 |
<thead>
|
3 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
4 |
-
|
5 |
|
6 |
-
|
7 |
<?php
|
8 |
$users = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
9 |
|
@@ -18,9 +18,9 @@
|
|
18 |
|
19 |
?>
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
25 |
-
|
26 |
</table>
|
1 |
<table class="wp-list-table widefat fixed striped users">
|
2 |
<thead>
|
3 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
4 |
+
</thead>
|
5 |
|
6 |
+
<tbody>
|
7 |
<?php
|
8 |
$users = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
9 |
|
18 |
|
19 |
?>
|
20 |
|
21 |
+
</tbody>
|
22 |
|
23 |
+
<tfoot>
|
24 |
<?php echo Wp_Temporary_Login_Without_Password_Layout::prepare_header_footer_row(); ?>
|
25 |
+
</tfoot>
|
26 |
</table>
|
templates/new_login.php
CHANGED
@@ -1,80 +1,83 @@
|
|
1 |
<h2> <?php echo __( 'Create a new Temporary Login', 'temporary-login-without-password' ); ?></h2>
|
2 |
<form method="post">
|
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 |
<?php if ( is_network_admin() ) { ?>
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
<?php } else { ?>
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
46 |
<?php } ?>
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
<span id="expiry-date-selection">
|
54 |
<select name="wtlwp_data[expiry]" id="user-expiry-time">
|
55 |
-
|
56 |
-
|
57 |
</span>
|
58 |
|
59 |
-
|
60 |
-
<input type="date" id="datepicker" name="wtlwp_data[custom_date]" value=""
|
61 |
-
class="example-datepicker"/>
|
62 |
</span>
|
63 |
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
</td>
|
77 |
-
</tr>
|
78 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
79 |
-
|
80 |
</form>
|
1 |
<h2> <?php echo __( 'Create a new Temporary Login', 'temporary-login-without-password' ); ?></h2>
|
2 |
<form method="post">
|
3 |
+
<table class="form-table wtlwp-form">
|
4 |
+
<tr class="form-field form-required">
|
5 |
+
<th scope="row" class="wtlwp-form-row">
|
6 |
+
<label for="user_email"><?php echo __( 'Email*', 'temporary-login-without-password' ); ?> </label>
|
7 |
+
</th>
|
8 |
+
<td>
|
9 |
+
<input name="wtlwp_data[user_email]" type="text" id="user_email" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
10 |
+
</td>
|
11 |
+
</tr>
|
12 |
|
13 |
+
<tr class="form-field form-required">
|
14 |
+
<th scope="row" class="wtlwp-form-row">
|
15 |
+
<label for="user_first_name"><?php echo __( 'First Name', 'temporary-login-without-password' ); ?> </label>
|
16 |
+
</th>
|
17 |
+
<td>
|
18 |
+
<input name="wtlwp_data[user_first_name]" type="text" id="user_first_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
|
22 |
+
<tr class="form-field form-required">
|
23 |
+
<th scope="row" class="wtlwp-form-row">
|
24 |
+
<label for="user_last_name"><?php echo __( 'Last Name', 'temporary-login-without-password' ); ?> </label>
|
25 |
+
</th>
|
26 |
+
<td>
|
27 |
+
<input name="wtlwp_data[user_last_name]" type="text" id="user_last_name" value="" aria-required="true" maxlength="60" class="wtlwp-form-input"/>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
|
31 |
<?php if ( is_network_admin() ) { ?>
|
32 |
+
<tr class="form-field form-required">
|
33 |
+
<th scope="row" class="wtlwp-form-row">
|
34 |
+
<label for="user_super_admin"><?php echo __( 'Super Admin', 'temporary-login-without-password' ); ?> </label>
|
35 |
+
</th>
|
36 |
+
<td>
|
37 |
+
<input type="checkbox" id="user_super_admin"
|
38 |
+
name="wtlwp_data[super_admin]"><?php echo __( 'Grant this user super admin privileges for the Network.', 'temporary-login-without-password' ); ?>
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
<?php } else { ?>
|
42 |
+
<tr class="form-field">
|
43 |
+
<th scope="row" class="wtlwp-form-row">
|
44 |
+
<label for="adduser-role"><?php echo __( 'Role', 'temporary-login-without-password' ); ?></label>
|
45 |
+
</th>
|
46 |
+
<td>
|
47 |
+
<select name="wtlwp_data[role]" id="user-role">
|
48 |
+
<?php Wp_Temporary_Login_Without_Password_Common::tlwp_dropdown_roles( $visible_roles, $default_role ); ?>
|
49 |
+
</select>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
<?php } ?>
|
53 |
|
54 |
+
<tr class="form-field">
|
55 |
+
<th scope="row" class="wtlwp-form-row">
|
56 |
+
<label for="adduser-role"><?php echo __( 'Expiry', 'temporary-login-without-password' ); ?></label>
|
57 |
+
</th>
|
58 |
+
<td>
|
59 |
<span id="expiry-date-selection">
|
60 |
<select name="wtlwp_data[expiry]" id="user-expiry-time">
|
61 |
+
<?php Wp_Temporary_Login_Without_Password_Common::get_expiry_duration_html(); ?>
|
62 |
+
</select>
|
63 |
</span>
|
64 |
|
65 |
+
<span style="display:none;" id="custom-date-picker">
|
66 |
+
<input type="date" id="datepicker" name="wtlwp_data[custom_date]" value="" class="example-datepicker"/>
|
|
|
67 |
</span>
|
68 |
|
69 |
+
</td>
|
70 |
+
</tr>
|
71 |
|
72 |
+
<tr class="form-field">
|
73 |
+
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
74 |
+
<td>
|
75 |
+
<p class="submit">
|
76 |
+
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php _e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login"> <?php _e( 'or', 'temporary-login-without-password' ); ?>
|
77 |
+
<span class="cancel-new-login-form" id="cancel-new-login-form"><?php _e( 'Cancel', 'temporary-login-without-password' ); ?></span>
|
78 |
+
</p>
|
79 |
+
</td>
|
80 |
+
</tr>
|
|
|
|
|
81 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
82 |
+
</table>
|
83 |
</form>
|
templates/temporary_logins_settings.php
CHANGED
@@ -1,26 +1,37 @@
|
|
1 |
<h2> <?php echo __( 'Temporary Login Settings', 'temporary-login-without-password' ); ?></h2>
|
2 |
<form method="post">
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<?php wp_dropdown_roles( $default_role ); ?>
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
<tr class="form-field">
|
16 |
-
<th scope="row" class="wtlwp-form-row"><label for="adduser-role"></label></th>
|
17 |
-
<td>
|
18 |
-
<p class="submit"><input type="submit" class="button button-primary wtlwp-form-submit-button"
|
19 |
-
value="<?php _e( 'Submit', 'temporary-login-without-password' ); ?>"
|
20 |
-
class="button button-primary" id="generatetemporarylogin"
|
21 |
-
name="generate_temporary_login"></p>
|
22 |
-
</td>
|
23 |
-
</tr>
|
24 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
25 |
-
|
26 |
</form>
|
1 |
<h2> <?php echo __( 'Temporary Login Settings', 'temporary-login-without-password' ); ?></h2>
|
2 |
<form method="post">
|
3 |
+
<table class="form-table wtlwp-form">
|
4 |
+
<tr class="form-field">
|
5 |
+
<th scope="row" class="wtlwp-form-row">
|
6 |
+
<label for="visible_roles"><?php echo __( 'Visible Roles', 'temporary-login-without-password' ); ?></label>
|
7 |
+
<p class="description"><?php echo __( 'select roles from which you want to create a temporary login', 'temporary-login-without-password' ); ?></p>
|
8 |
+
|
9 |
+
</th>
|
10 |
+
<td>
|
11 |
+
<select multiple name="tlwp_settings_data[visible_roles][]" id="visible-roles" class="visible-roles-dropdown">
|
12 |
+
<?php Wp_Temporary_Login_Without_Password_Common::tlwp_multi_select_dropdown_roles( $visible_roles ); ?>
|
13 |
+
</select>
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
<tr class="form-field">
|
17 |
+
<th scope="row" class="wtlwp-form-row">
|
18 |
+
<label for="adduser-role"><?php echo __( 'Default Role', 'temporary-login-without-password' ); ?></label>
|
19 |
+
</th>
|
20 |
+
<td>
|
21 |
+
<select name="tlwp_settings_data[default_role]" id="default-role" class="default-role-dropdown">
|
22 |
<?php wp_dropdown_roles( $default_role ); ?>
|
23 |
+
</select>
|
24 |
+
</td>
|
25 |
+
</tr>
|
26 |
+
|
27 |
+
<tr class="form-field">
|
28 |
+
<td>
|
29 |
+
<p class="submit">
|
30 |
+
<input type="submit" class="button button-primary wtlwp-form-submit-button" value="<?php _e( 'Submit', 'temporary-login-without-password' ); ?>" class="button button-primary" id="generatetemporarylogin" name="generate_temporary_login">
|
31 |
+
</p>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
<?php wp_nonce_field( 'wtlwp_generate_login_url', 'wtlwp-nonce', true, true ); ?>
|
36 |
+
</table>
|
37 |
</form>
|
temporary-login-without-password.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* 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.
|
6 |
-
* Version: 1.5.
|
7 |
* Author: StoreApps
|
8 |
* Author URI: http://storeapps.org
|
9 |
* Requires at least: 3.3
|
@@ -20,6 +20,11 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
die;
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* Deactivate Temporary Login Without Password
|
25 |
*
|
@@ -54,7 +59,6 @@ require plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without
|
|
54 |
*/
|
55 |
function run_wp_temporary_login_without_password() {
|
56 |
$plugin = new Wp_Temporary_Login_Without_Password();
|
57 |
-
$plugin->define_constant( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
58 |
$plugin->run();
|
59 |
}
|
60 |
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* 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.
|
6 |
+
* Version: 1.5.2
|
7 |
* Author: StoreApps
|
8 |
* Author URI: http://storeapps.org
|
9 |
* Requires at least: 3.3
|
20 |
die;
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Define constants
|
25 |
+
*/
|
26 |
+
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
27 |
+
|
28 |
/**
|
29 |
* Deactivate Temporary Login Without Password
|
30 |
*
|
59 |
*/
|
60 |
function run_wp_temporary_login_without_password() {
|
61 |
$plugin = new Wp_Temporary_Login_Without_Password();
|
|
|
62 |
$plugin->run();
|
63 |
}
|
64 |
|
uninstall.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Fired when the plugin is uninstalled.
|
4 |
-
*
|
5 |
* @package Temporary Login Without Password
|
6 |
*/
|
7 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Fired when the plugin is uninstalled.
|
4 |
+
*
|
5 |
* @package Temporary Login Without Password
|
6 |
*/
|
7 |
|