BuddyPressCommand::get_user_id_from_identifier( mixed $identifier )

Verify a user ID by the passed identifier.


Parameters Parameters

$identifier

(mixed) (Required) User ID, email or login.


Top ↑

Return Return

(BuddypressCLICommandWP_User)


Source Source

File: cli/src/command.php

	protected function get_user_id_from_identifier( $identifier ) {
		if ( is_numeric( $identifier ) ) {
			$user = get_user_by( 'id', $identifier );
		} elseif ( is_email( $identifier ) ) {
			$user = get_user_by( 'email', $identifier );
		} else {
			$user = get_user_by( 'login', $identifier );
		}

		if ( ! $user ) {
			WP_CLI::error( sprintf( 'No user found by that username or ID (%s).', $identifier ) );
		}

		return $user;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.