Temporary Login Without Password - Version 1.6.2

Version Description

Download this release

Release Info

Developer storeapps
Plugin Icon 128x128 Temporary Login Without Password
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

admin/class-wp-temporary-login-without-password-admin.php CHANGED
@@ -58,6 +58,7 @@ class Wp_Temporary_Login_Without_Password_Admin {
58
  wp_enqueue_style( 'jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
59
  }
60
  }
 
61
  }
62
 
63
  /**
@@ -121,6 +122,8 @@ class Wp_Temporary_Login_Without_Password_Admin {
121
  );
122
  }
123
 
 
 
124
  /**
125
  * Manage admin settings
126
  *
@@ -546,20 +549,18 @@ class Wp_Temporary_Login_Without_Password_Admin {
546
  *
547
  * @return bool
548
  *
549
- * @since 1.5.4
550
  */
551
  public function tlwp_show_temporary_access_notice_in_admin_bar( $wp_admin_bar ) {
552
 
553
- $current_user_id = get_current_user_id();
554
-
555
- $is_valid_temporary_user = Wp_Temporary_Login_Without_Password_Common::is_valid_temporary_login( $current_user_id );
556
 
557
  if ( $is_valid_temporary_user ) {
558
  // Add the main site admin menu item.
559
  $wp_admin_bar->add_menu(
560
  array(
561
  'id' => 'temporay-access-notice',
562
- 'href' => admin_url(),
563
  'parent' => 'top-secondary',
564
  'title' => __( 'Temporary Access', 'temporary-login-without-password' ),
565
  'meta' => array( 'class' => 'temporay-access-mode-active' ),
@@ -568,7 +569,31 @@ class Wp_Temporary_Login_Without_Password_Admin {
568
  }
569
 
570
  return true;
 
 
 
 
 
 
 
 
 
 
 
571
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  }
573
 
574
  }
58
  wp_enqueue_style( 'jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
59
  }
60
  }
61
+
62
  }
63
 
64
  /**
122
  );
123
  }
124
 
125
+
126
+
127
  /**
128
  * Manage admin settings
129
  *
549
  *
550
  * @return bool
551
  *
552
+ * @since 1.6.2
553
  */
554
  public function tlwp_show_temporary_access_notice_in_admin_bar( $wp_admin_bar ) {
555
 
556
+ $is_valid_temporary_user = Wp_Temporary_Login_Without_Password_Common::is_current_user_valid_temporary_user();
 
 
557
 
558
  if ( $is_valid_temporary_user ) {
559
  // Add the main site admin menu item.
560
  $wp_admin_bar->add_menu(
561
  array(
562
  'id' => 'temporay-access-notice',
563
+ 'href' => admin_url('users.php?page=wp-temporary-login-without-password'),
564
  'parent' => 'top-secondary',
565
  'title' => __( 'Temporary Access', 'temporary-login-without-password' ),
566
  'meta' => array( 'class' => 'temporay-access-mode-active' ),
569
  }
570
 
571
  return true;
572
+ }
573
+
574
+ /**
575
+ * Add temporary access bar css
576
+ *
577
+ * @since 1.6.2
578
+ */
579
+ function tlwp_test_mode_notice_admin_bar_css() {
580
+ if ( ! Wp_Temporary_Login_Without_Password_Common::is_current_user_valid_temporary_user() ) {
581
+ return;
582
+ }
583
 
584
+ ?>
585
+ <style>
586
+ #wpadminbar .temporay-access-mode-active > .ab-item {
587
+ color: #fff;
588
+ background-color: #ffba00;
589
+ }
590
+
591
+ #wpadminbar .temporay-access-mode-active:hover > .ab-item, #wpadminbar .temporay-access-mode-active:hover > .ab-item {
592
+ background-color: rgba(203, 144, 0, 1) !important;
593
+ color: #fff !important;
594
+ }
595
+ </style>
596
+ <?php
597
  }
598
 
599
  }
admin/css/wp-temporary-login-without-password-admin.css CHANGED
@@ -111,4 +111,4 @@
111
  input[type=date]::-webkit-calendar-picker-indicator {
112
  -webkit-appearance: none;
113
  display: none;
114
- }
111
  input[type=date]::-webkit-calendar-picker-indicator {
112
  -webkit-appearance: none;
113
  display: none;
114
+ }
includes/class-wp-temporary-login-without-password-activator.php CHANGED
@@ -18,6 +18,7 @@ class Wp_Temporary_Login_Without_Password_Activator {
18
  * @since 1.0.0
19
  */
20
  public static function activate() {
 
21
  /**
22
  * Process
23
  *
@@ -27,7 +28,6 @@ class Wp_Temporary_Login_Without_Password_Activator {
27
  * - Set activation timestamp
28
  * - Set plugin version
29
  */
30
-
31
  $temporary_logins_data = get_option( 'temporary_logins_data', array() );
32
 
33
  if ( count( $temporary_logins_data ) > 0 ) {
18
  * @since 1.0.0
19
  */
20
  public static function activate() {
21
+
22
  /**
23
  * Process
24
  *
28
  * - Set activation timestamp
29
  * - Set plugin version
30
  */
 
31
  $temporary_logins_data = get_option( 'temporary_logins_data', array() );
32
 
33
  if ( count( $temporary_logins_data ) > 0 ) {
includes/class-wp-temporary-login-without-password-common.php CHANGED
@@ -1019,4 +1019,17 @@ class Wp_Temporary_Login_Without_Password_Common {
1019
  return false;
1020
  }
1021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  }
1019
  return false;
1020
  }
1021
 
1022
+ /**
1023
+ * Check Whether current user is temporary user
1024
+ *
1025
+ * @return bool
1026
+ *
1027
+ * @since 1.6.2
1028
+ */
1029
+ public static function is_current_user_valid_temporary_user() {
1030
+ $current_user_id = get_current_user_id();
1031
+
1032
+ return self::is_valid_temporary_login( $current_user_id );
1033
+ }
1034
+
1035
  }
includes/class-wp-temporary-login-without-password.php CHANGED
@@ -111,6 +111,8 @@ class Wp_Temporary_Login_Without_Password {
111
  $this->loader->add_action( 'admin_init', $plugin_admin, 'update_tlwp_settings' );
112
  $this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
113
  $this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
 
 
114
 
115
  $this->loader->add_filter( 'wpmu_welcome_notification', $plugin_admin, 'disable_welcome_notification', 10, 5 );
116
  $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'disable_plugin_deactivation', 10, 4 );
111
  $this->loader->add_action( 'admin_init', $plugin_admin, 'update_tlwp_settings' );
112
  $this->loader->add_action( 'admin_init', $plugin_admin, 'manage_temporary_login' );
113
  $this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notices' );
114
+ $this->loader->add_action( 'admin_bar_menu', $plugin_admin, 'tlwp_show_temporary_access_notice_in_admin_bar', 999 );
115
+ $this->loader->add_action( 'admin_head', $plugin_admin, 'tlwp_test_mode_notice_admin_bar_css', 999 );
116
 
117
  $this->loader->add_filter( 'wpmu_welcome_notification', $plugin_admin, 'disable_welcome_notification', 10, 5 );
118
  $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'disable_plugin_deactivation', 10, 4 );
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=BMFRMVXQ87JWA&source=url
4
  Tags: temporary access, developer access, admin login, temporary login, passwordless login, 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, user, WordPress Admin, wp-admin, developer login
5
  Requires at least: 3.0.1
6
- Tested up to: 5.4
7
- Stable tag: 1.6.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -78,6 +78,10 @@ No. at this moment it's not possible to do this.
78
 
79
  == Changelog ==
80
 
 
 
 
 
81
  **1.6.1 [2020-04-11]**
82
 
83
  * Update: Compatibility test with WordPress 5.4
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BMFRMVXQ87JWA&source=url
4
  Tags: temporary access, developer access, admin login, temporary login, passwordless login, 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, user, WordPress Admin, wp-admin, developer login
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.4.1
7
+ Stable tag: 1.6.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
78
 
79
  == Changelog ==
80
 
81
+ **1.6.2 [2020-05-30]**
82
+
83
+ * New: Notify about Temporary Access in admin bar
84
+
85
  **1.6.1 [2020-04-11]**
86
 
87
  * Update: Compatibility test with WordPress 5.4
temporary-login-without-password.php CHANGED
@@ -3,11 +3,11 @@
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.6.1
7
  * Author: StoreApps
8
  * Author URI: https://storeapps.org
9
  * Requires at least: 3.0.1
10
- * Tested up to: 5.4
11
  * License: GPLv3
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
  * Text Domain: temporary-login-without-password
@@ -25,7 +25,7 @@ if ( ! defined( 'WPINC' ) ) {
25
  /**
26
  * Define constants
27
  */
28
- define( 'WTLWP_PLUGIN_VERSION', '1.6.1' );
29
  define( 'WTLWP_FEEDBACK_VERSION', '1.2.1' );
30
  define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
31
  define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
@@ -49,12 +49,29 @@ function wp_deactivate_temporary_login_without_password() {
49
  function wp_activate_temporary_login_without_password() {
50
  require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password-activator.php';
51
  Wp_Temporary_Login_Without_Password_Activator::activate();
 
52
  }
53
 
54
  register_deactivation_hook( __FILE__, 'wp_deactivate_temporary_login_without_password' );
55
  register_activation_hook( __FILE__, 'wp_activate_temporary_login_without_password' );
56
 
 
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  // Include main class file.
59
  require plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password.php';
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.6.2
7
  * Author: StoreApps
8
  * Author URI: https://storeapps.org
9
  * Requires at least: 3.0.1
10
+ * Tested up to: 5.4.1
11
  * License: GPLv3
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
  * Text Domain: temporary-login-without-password
25
  /**
26
  * Define constants
27
  */
28
+ define( 'WTLWP_PLUGIN_VERSION', '1.6.2' );
29
  define( 'WTLWP_FEEDBACK_VERSION', '1.2.1' );
30
  define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
31
  define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
49
  function wp_activate_temporary_login_without_password() {
50
  require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password-activator.php';
51
  Wp_Temporary_Login_Without_Password_Activator::activate();
52
+ add_option( 'tlwp_do_activation_redirect', true );
53
  }
54
 
55
  register_deactivation_hook( __FILE__, 'wp_deactivate_temporary_login_without_password' );
56
  register_activation_hook( __FILE__, 'wp_activate_temporary_login_without_password' );
57
 
58
+ add_action( 'admin_init', 'tlwp_redirect' );
59
 
60
+ if ( ! function_exists( 'tlwp_redirect' ) ) {
61
+
62
+ function tlwp_redirect() {
63
+
64
+ // Check if it is multisite and the current user is in the network administrative interface. e.g. `/wp-admin/network/`
65
+ if( is_multisite() && is_network_admin() ) {
66
+ return;
67
+ }
68
+
69
+ if ( get_option( 'tlwp_do_activation_redirect', false ) ) {
70
+ delete_option( 'tlwp_do_activation_redirect' );
71
+ wp_redirect( 'users.php?page=wp-temporary-login-without-password' );
72
+ }
73
+ }
74
+ }
75
  // Include main class file.
76
  require plugin_dir_path( __FILE__ ) . 'includes/class-wp-temporary-login-without-password.php';
77