PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 2.5.0
WP 2FA – Two-factor authentication for WordPress v2.5.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / Admin / class-user-registered.php
wp-2fa / includes / classes / Admin Last commit date
Controllers 2 years ago Helpers 2 years ago Methods 2 years ago SettingsPages 2 years ago Views 2 years ago class-help-contact-us.php 2 years ago class-premium-features.php 2 years ago class-settings-page.php 2 years ago class-setup-wizard.php 2 years ago class-user-listing.php 2 years ago class-user-notices.php 2 years ago class-user-profile.php 2 years ago class-user-registered.php 2 years ago index.php 5 years ago
class-user-registered.php
52 lines
1 <?php
2 /**
3 * Responsible for WP2FA user's grace periods.
4 *
5 * @package wp2fa
6 * @subpackage user-utils
7 * @copyright %%YEAR%% Melapress
8 * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
9 * @link https://wordpress.org/plugins/wp-2fa/
10 */
11
12 namespace WP2FA\Admin;
13
14 use WP2FA\Admin\Helpers\User_Helper;
15
16 if ( ! class_exists( '\WP2FA\Admin\User_Registered' ) ) {
17 /**
18 * User_Profile - Class for handling user things such as profile settings and admin list views.
19 */
20 class User_Registered {
21
22 /**
23 * Apply 2FA Grace period
24 *
25 * @param int $user_id User id.
26 *
27 * @return void
28 */
29 public static function apply_2fa_grace_period( $user_id ) {
30 if ( User_Helper::is_user_method_in_role_enabled_methods( $user_id ) ) {
31 return;
32 } else {
33 User_Helper::remove_enabled_method_for_user( $user_id );
34 User_Helper::remove_global_settings_hash_for_user( $user_id );
35 }
36 }
37
38 /**
39 * Checks the user on role change.
40 *
41 * @param integer $user_id - The ID of the user.
42 * @param string $role - The user role.
43 * @param array $old_roles - Old roles for the user.
44 *
45 * @return void
46 */
47 public static function check_user_upon_role_change( $user_id, $role, $old_roles ) {
48 self::apply_2fa_grace_period( $user_id );
49 }
50 }
51 }
52