WP_Application_Passwords::get_user_application_passwords() – Gets a user’s application passwords.

You appear to be a bot. Output may be restricted

Description

Gets a user's application passwords.

Usage

$array = WP_Application_Passwords::get_user_application_passwords( $user_id );

Parameters

$user_id
( int ) required – User ID.
…$0
( array ) required – {
$uuid
( string ) required – The unique identifier for the application password.
$app_id
( string ) required – A UUID provided by the application to uniquely identify it.
$name
( string ) required – The name of the application password.
$password
( string ) required – A one-way hash of the password.
$created
( int ) required – Unix timestamp of when the password was created.
$last_used
( int|null ) required – The Unix timestamp of the GMT date the application password was last used.
$last_ip
( string|null ) required – The IP address the application password was last used by. } }

Returns

array { The list of app passwords.

Source

File name: wordpress/wp-includes/class-wp-application-passwords.php
Lines:

1 to 22 of 22
  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;
  }
 

 View on GitHub View on Trac