[wp-hackers] Updating a User Record via PHP?
Jeremy Clarke
jer at simianuprising.com
Mon Feb 2 19:55:13 GMT 2009
On Mon, Feb 2, 2009 at 2:19 PM, Matt Martz <mdmartz at sivel.net> wrote:
>> Aye, there's the rub, eh? Getting a proper $userdata seems to be the issue.
>>
>> Did you guys know that core sometimes expects $userdata to be an array and sometimes it expects it to be an object? Hard to write/debug code that interacts with it given that inconsistency.
>
Just in case people are interested, here's a trac ticket I filed about
the badness/strangeness of the whole $userdata thing:
http://trac.wordpress.org/ticket/8911
It proposes to always use objects for users (like terms) and to use
the $WP_User object type (and a get_user() function as a wrapper like
get_term) instead of the out of date get_userdata (why even have
'data' in teh function name, what else would you get?).
Also note that get_users_of_blog() returns some stuff that is
radically incompatible with everything else present in the user system
of WP (it foolishly uses the user_id field of the usermeta table
instead of the ID field of the users table, so that breaks pretty much
everything that looks for the ID). If you are using the output of it
you'll want to either add the ID variable into the results manually or
process it some other way. (actually, now that I think of it the id
problem in get_users_of_blog could be fixed with a microscopic patch
that just fetches both the ID and user_id fields in the sql, it would
have but but the redundancy would be pretty tame, i'll do that now:
http://trac.wordpress.org/ticket/9020 )
--
Jeremy Clarke | http://simianuprising.com
Code and Design | http://globalvoicesonline.org
More information about the wp-hackers
mailing list