Свойство | Тип | Описание | |
---|---|---|---|
$message_replace | boolean | string | Set to a string to indicate a message to replace, but defaults to false. | |
$registering_a11n | boolean | A flag to indicate the user being registered is an A12n (i.e. VIP). | |
$reverting_role | A flag to indicate reversion and then to prevent recursion. |
Метод | Описание | |
---|---|---|
__construct ( ) | Class constructor. Handles hooking actions and filters, and sets some properties. | |
action_admin_head ( ) | Hooks the admin_head action to add some CSS into the user edit and profile screens. | |
action_admin_notices ( ) | Hooks the admin_notices action to add some admin notices, also resends verification emails when required. | |
action_load_profile ( ) | Hooks the load action on the profile screen to send verification email if required. | |
action_load_user_edit ( ) | Hooks the load action on the user edit screen to send verification email if required. | |
action_parse_request ( ) | Hooks the parse_request action to do any email verification. | |
action_password_reset ( object $user ) | ||
action_personal_options ( object $user ) | Hooks the personal_options action on the user edit and profile screens to add verification status for the user's email. | |
action_profile_update ( integer $user_id ) | Hooks the profile_update action to delete the email verification meta when the user's email address changes. | |
action_set_user_role ( integer $user_id, string $role, array $old_roles ) | Hooks the set_user_role action to check if we're setting the user to the VIP Support role. If we are setting to the VIP Support role, various checks are run, and the transition may be reverted. | |
action_user_register ( integer $user_id ) | Hooks the user_register action to determine if we're registering an A12n, and so need an email verification. Also checks if the registered user cannot be set to VIP Support role (as not an A12n). | |
action_wp_login ( $user_login, WP_User $user ) : void | Hooks the wp_login action to make any verified VIP Support user a Super Admin! | |
filter_removable_query_args ( array $args ) : array | Hooks the removable_query_args filter to add our arguments to those tidied up by Javascript so the user sees nicer URLs. | |
filter_wp_redirect ( $location ) : string | Filters wp_redirect so we can replace the query string arguments and manipulate the admin notice shown to the user to reflect what has happened (e.g. role setting has been rejected as the user is not an A12n). | |
init ( ) : WPCOM_VIP_Support_User | Initiate an instance of this class if one doesn't exist already. Return the WPCOM_VIP_Support_User instance. | |
is_a8c_email ( string $email ) : boolean | Is a provided string an email address using an A8c domain. | |
is_verified_automattician ( $user_id ) : boolean | Determine if a given user has been validated as an Automattician | |
mark_user_email_verified ( integer $user_id, string $user_email ) | ||
user_has_vip_support_role ( $user_id, $active_role = true ) |
Метод | Описание | |
---|---|---|
create_check_hash ( integer $user_id, string $verification_code, string $user_email ) : string | The hash sent in the email verification link is composed of the user ID, a verification code generated and stored when the email was sent (a random string), and the user email. The idea being that each verification link is tied to a user AND a particular email address, so a link does not work if the user has subsequently changed their email and does not work for another logged in or anonymous user. | |
demote_user_from_vip_support_to ( $user_id, $revert_role_to ) | Demote a user to a | |
get_trigger_resend_verification_url ( ) : string | Create and return a URL with a parameter which will trigger the resending of a verification email. | |
get_user_email_verification_code ( integer $user_id ) : string | Provide a randomly generated verification code to share via the email verification link. | |
mark_user_email_unverified ( integer $user_id ) | ||
promote_user_to_vip_support ( $user_id ) | ||
send_verification_email ( integer $user_id ) | Send a user an email with a verification link for their current email address. | |
user_has_verified_email ( integer $user_id ) : boolean | Check if a user has verified their email address. |
public __construct ( ) |
public action_admin_head ( ) |
public action_admin_notices ( ) |
public action_load_profile ( ) |
public action_load_user_edit ( ) |
public action_parse_request ( ) |
public action_password_reset ( object $user ) | ||
$user | object | A WP_User object |
public action_personal_options ( object $user ) | ||
$user | object | The WP_User object representing the user being edited |
public action_profile_update ( integer $user_id ) | ||
$user_id | integer | The ID of the user whose profile was just updated |
public action_user_register ( integer $user_id ) | ||
$user_id | integer | The ID of the user which has been registered. |
public action_wp_login ( $user_login, WP_User $user ) : void | ||
$user_login | The login for the logging in user | |
$user | WP_User | The WP_User object for the logging in user |
Результат | void |
protected create_check_hash ( integer $user_id, string $verification_code, string $user_email ) : string | ||
$user_id | integer | The ID of the user to generate the hash for |
$verification_code | string | A string of random characters |
$user_email | string | The email of the user to generate the hash for |
Результат | string | The check hash for the values passed |
protected demote_user_from_vip_support_to ( $user_id, $revert_role_to ) | ||
$user_id | ||
$revert_role_to |
public filter_removable_query_args ( array $args ) : array | ||
$args | array | An array of URL parameter names which are tidied away |
Результат | array | An array of URL parameter names which are tidied away |
public filter_wp_redirect ( $location ) : string | ||
$location | ||
Результат | string |
protected get_trigger_resend_verification_url ( ) : string | ||
Результат | string | A URL with a parameter to trigger a verification email |
protected get_user_email_verification_code ( integer $user_id ) : string | ||
$user_id | integer | The ID of the user to get the verification code for |
Результат | string | A random hex string |
public static init ( ) : WPCOM_VIP_Support_User | ||
Результат | WPCOM_VIP_Support_User | object The instance of WPCOM_VIP_Support_User |
public is_a8c_email ( string $email ) : boolean | ||
string | An email address to check | |
Результат | boolean | True if the string is an email with an A8c domain |
public static is_verified_automattician ( $user_id ) : boolean | ||
Результат | boolean | Boolean indicating if the account is a valid Automattician |
protected mark_user_email_unverified ( integer $user_id ) | ||
$user_id | integer | The ID of the user to mark as NOT (any longer) having a verified email |
public mark_user_email_verified ( integer $user_id, string $user_email ) | ||
$user_id | integer | The ID of the user to mark as having a verified email |
$user_email | string | The email which has been verified |
protected promote_user_to_vip_support ( $user_id ) | ||
$user_id |
protected send_verification_email ( integer $user_id ) | ||
$user_id | integer | The ID of the user to send the email to |
protected user_has_verified_email ( integer $user_id ) : boolean | ||
$user_id | integer | The ID of the user to check |
Результат | boolean | True if the user has a verified email address, otherwise false |
public user_has_vip_support_role ( $user_id, $active_role = true ) |
protected bool $registering_a11n | ||
Результат | boolean |