get_user_id_from_string [ WordPress Function ]
get_user_id_from_string ( $string )
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_user_setting, get_post_format_string, get_post_format_strings, get_user_option, set_user_setting
Get a numeric user ID from either an email address or a login.
Source
<?php
function get_user_id_from_string( $string ) {
$user_id = 0;
if ( is_email( $string ) ) {
$user = get_user_by('email', $string);
if ( $user )
$user_id = $user->ID;
} elseif ( is_numeric( $string ) ) {
$user_id = $string;
} else {
$user = get_user_by('login', $string);
if ( $user )
$user_id = $user->ID;
}
return $user_id;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- WPMU Functions/get user id from string « WordPress Codex
Description. Returns the user ID of the user specified by either username or registered email address. In order to use this function in plugins, you must include ...
codex.wordpress.org - Function Reference/get user id from string « WordPress Codex
Description. Get a numeric user ID from either an email address or a login. Usage . <?php get_user_id_from_string( $string ); ?> Parameters. $string: (string) ...
codex.wordpress.org - get_user_id_from_string (WordPress Function) - WPSeek.com
WordPress lookup for get_user_id_from_string, a WordPress Function. wpseek. com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_user_id_from_string | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_user_id_from_string( $string ) { $user_id = 0; if ( is_email( $string ) ) { $user = get_user_by('email', $string); if ( $user ) $user_id ...
hitchhackerguide.com