/var/www/wp2.qr4y.com/www/wp-content/plugins/elementor-pro/modules/notes/database/models
Edit: /var/www/wp2.qr4y.com/www/wp-content/plugins/elementor-pro/modules/notes/database/models/user.php (2255B)
self::TYPE_INTEGER,
];
/**
* Initialize a new `User` object from a `WP_User` object.
*
* @param \WP_User $user - WP_User object.
*
* @return static
*/
public static function from_wp_user( \WP_User $user ) {
return new static( (array) $user->data );
}
/**
* Override the default Query Builder.
*
* @param \wpdb|null $connection
*
* @return \ElementorPro\Modules\Notes\Database\Query\User_Query_Builder()
*/
public static function query( \wpdb $connection = null ) {
return ( new User_Query_Builder( $connection ) )->from( static::get_table() );
}
/**
* Get the model's table name.
*
* @return string
*/
public static function get_table() {
return 'users';
}
/**
* Generate avatars urls based on user id.
*
* @param $id
*
* @return Collection
*/
public static function generate_avatars_urls( $id ) {
return ( new Collection( [ 24, 48, 96 ] ) )->map_with_keys( function ( $size ) use ( $id ) {
return [ $size => get_avatar_url( $id, [ 'size' => $size ] ) ];
} );
}
/**
* Get the user's avatars.
*
* @return Collection
*/
public function get_avatars() {
return static::generate_avatars_urls( $this->ID );
}
}