Gets a user’s application passwords.
Parameters
$user_id
intrequired- User ID.
Return
array The list of application passwords....$0
arrayuuid
stringThe unique identifier for the application password.app_id
stringA UUID provided by the application to uniquely identify it.name
stringThe name of the application password.password
stringA one-way hash of the password.created
intUnix timestamp of when the password was created.last_used
int|nullThe Unix timestamp of the GMT date the application password was last used.last_ip
string|nullThe IP address the application password was last used by.
Source
public static function get_user_application_passwords( $user_id ) { $passwords = get_user_meta( $user_id, static::USERMETA_KEY_APPLICATION_PASSWORDS, true ); if ( ! is_array( $passwords ) ) { return array(); } $save = false; foreach ( $passwords as $i => $password ) { if ( ! isset( $password['uuid'] ) ) { $passwords[ $i ]['uuid'] = wp_generate_uuid4(); $save = true; } } if ( $save ) { static::set_user_application_passwords( $user_id, $passwords ); } return $passwords; }
Related
Uses Description wp_generate_uuid4() wp-includes/functions.php
Generates a random UUID (version 4).
get_user_meta() wp-includes/user.php
Retrieves user meta field for a user.
Used by Description WP_REST_Application_Passwords_Controller::get_items() wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
Retrieves a collection of application passwords.
wp_authenticate_application_password() wp-includes/user.php
Authenticates the user using an application password.
WP_Application_Passwords_List_Table::prepare_items() wp-admin/includes/class-wp-application-passwords-list-table.php
Prepares the list of items for displaying.
Changelog
Version Description 5.6.0 Introduced.
User Contributed Notes
You must log in before being able to contribute a note or feedback.