wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_usermeta [ WordPress Function ]
| Parameter: |
|
| Siehe: | |
| Gibt zurück: |
|
| Definiert in: |
|
Retrieve user metadata.
If $user_id is not a number, then the function will fail over with a 'false' boolean return value. Other returned values depend on whether there is only one item to be returned, which be that single item type. If there is more than one metadata value, then it will be list of metadata values.
Source
<?php
function get_usermeta( $user_id, $meta_key = '' ) {
_deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' );
global $wpdb;
$user_id = (int) $user_id;
if ( !$user_id )
return false;
if ( !empty($meta_key) ) {
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
$user = wp_cache_get($user_id, 'users');
// Check the cached user object
if ( false !== $user && isset($user->$meta_key) )
$metas = array($user->$meta_key);
else
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
} else {
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
}
if ( empty($metas) ) {
if ( empty($meta_key) )
return array();
else
return '';
}
$metas = array_map('maybe_unserialize', $metas);
if ( count($metas) == 1 )
return $metas[0];
else
return $metas;
}
?>
Beispiele [ wp-snippets.com ]
Top Google Suchergebnisse
- Function Reference/get usermeta « WordPress Codex
This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions.
codex.wordpress.org - WordPress › Support » get_usermeta question
I'm a relative PHP newbie, so this is probably easy (but driving me nuts...) I've installed the WP User Manager plugin, to get extra fields for users. I've added an ...
wordpress.org - coding - get_usermeta() deprecated in favor of get_user_meta(). But ...
Feb 9, 2011 ... get_usermeta() is deprecated since version 3.0. The warning suggests me to use get_user_meta() . Even the parameters are pretty similar, ...
wordpress.stackexchange.com - get_usermeta | A HitchHackers guide through WordPress
Feb 12, 2011 ... If $user_id is not a number, then the function will fail over with a 'false' boolean return value. Other returned values depend on whether there is ...
hitchhackerguide.com
Nutzerduskussionen [ wordpress.org ]
- BrenFM on "get_usermeta deprecated by get_user_meta not working"
- MichaelH on "get_user_meta Function Undefined"
- WebTechGlobal on "get_user_meta Function Undefined"
- spencersokol on "Wrapping Paragraphs and the Author Description"
- lorenzo on "get_usermeta question"
- barrybell on "get_usermeta question"
- tcervo on "get_usermeta question"
- tcervo on "get_usermeta question"
- tcervo on "get_usermeta question"
- tcervo on "get_usermeta question"