[wp-hackers] get_user_meta returning empty string

Muro, Matthew mmuro at advance.ua.edu
Wed Nov 24 18:10:07 UTC 2010


Either way, the fix is to grab the global $table_prefix.

Can you explain why get_userdata is better than get_user_meta?  I don't mind switching, but it would be helpful to know the difference.

Matthew Muro
Web Developer
UA Office of Web Communications



On Wed, Nov 24, 2010 at 7:35 PM, scribu <m...<http://groups.google.com/groups/unlock?_done=/group/wp-hackers/browse_thread/thread/90ad24814648dd47&msg=908f6daa02989e7e>@scribu.net> wrote:
> On Wed, Nov 24, 2010 at 7:16 PM, Muro, Matthew <mm...<http://groups.google.com/groups/unlock?_done=/group/wp-hackers/browse_thread/thread/90ad24814648dd47&msg=908f6daa02989e7e>@advance.ua.edu>wrote:

>> Never underestimate the power of posting.  The problem ended up being that
>> someone using a different $table_prefix other than "wp_" wouldn't have the
>> meta_key "wp_capabilities".

>> Let me know if I'm jumping to conclusions here, but I'm able to reproduce
>> the error.

> That would only happen if you change the table prefix *after* WP is
> installed.


To clarify, the capability key is generated based on the table prefix. This
allows users to have different capabilities on different sites in a
MultiSite environment.

Also, you should probably be using get_userdata() instead.


More information about the wp-hackers mailing list