[wp-hackers] users vs. usermeta

Dougal Campbell dougal at gunters.org
Wed Dec 14 16:01:41 GMT 2005

John Joseph Bachir wrote:
> Greetings,
> What is the philosophy behind which data types are hardcoded into the 
> `users` table, and which go into the `usermeta` table? It seems like 
> everything that is always used in WordPress (at least `wp_user_level` 
> and `wp_capabilities`, and perhaps also the other options which are 
> initially blank, such as the various IM usernames) can/should go into 
> the users table, and the usermeta table can be available for plugins.

Yes, some of those fields *should* be moved into usermeta. But they 
remain in the users table for now in order to maintain backwards 
compatibility. I imagine that at some point, we could add a new generic 
user information function which would transparently fetch fields from 
the appropriate table.

It could first check the (possibly cached) user object, and if a 
matching field doesn't exist there, fall back to searching the usermeta 
data. Then if replace all current code which checks user properties with 
calls to that function, we could move fields out of the users table into 
usermeta, without impacting any plugins that used the new method.

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list