Definition:
function setup_userdata($for_user_id = '') {}
Parameters
- int $for_user_id: Optional. User ID to set up global data.
Source code
function setup_userdata($for_user_id = '') {
global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
if ( '' == $for_user_id )
$user = wp_get_current_user();
else
$user = new WP_User($for_user_id);
$userdata = $user->data;
$user_ID = (int) $user->ID;
$user_level = (int) isset($user->user_level) ? $user->user_level : 0;
if ( 0 == $user->ID ) {
$user_login = $user_email = $user_url = $user_pass_md5 = $user_identity = '';
return;
}
$user_login = $user->user_login;
$user_email = $user->user_email;
$user_url = $user->user_url;
$user_pass_md5 = md5($user->user_pass);
$user_identity = $user->display_name;
}
2839

February 12, 2011 


separate_comments
Definition:
function &separate_comments(&$comments) {}
Parameters
Return values
returns:Array of comments keyed by comment_type.
Source code
function &separate_comments(&$comments) { $comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array()); $count = count($comments); for ( $i = 0; $i < $count; $i++ ) { $type = $comments[$i]->comment_type; if ( empty($type) ) $type = 'comment'; $comments_by_type[$type][] = &$comments[$i]; if ( 'trackback' == $type || 'pingback' == $type ) $comments_by_type['pings'][] = &$comments[$i]; } return $comments_by_type; }2831