[wp-trac] [WordPress Trac] #19540: get_userdata() doesn't include meta values in 'data' property
WordPress Trac
wp-trac at lists.automattic.com
Wed Dec 14 00:04:37 UTC 2011
#19540: get_userdata() doesn't include meta values in 'data' property
--------------------------+-----------------------------
Reporter: beautomated | Owner: otto
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 3.3
Severity: major | Keywords:
--------------------------+-----------------------------
The following code worked in v3.2.1 and broke in v3.3. The custom meta
value for "company" is empty, returning 'N/A' instead of what it should
be: 'ABC Corporation'.
update_user_meta(get_current_user_id(), 'company', 'ABC Corporation');
$users = get_users(array('role' => 'administrator'));
foreach ($users as $user) {
$user = get_userdata($user->ID);
$company = (property_exists($user, 'company') && ($val =
$user->company)) ? $val : 'N/A';
echo "You work for {$company}<br />";
}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19540>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list