[wp-hackers] users vs. usermeta

Owen Winkler ringmaster at midnightcircus.com
Wed Dec 14 17:54:05 GMT 2005


Rob wrote:
> Does this "dynamic" feel to data such as IM systems mean that there will 
> be a dynamic user information page in the admin panel, too? It would be 
> nice if, as a plugin writer, I could add a usermeta field and have it 
> appear in the Users -> Your Profile screen automatically.
> 
> The problems I can immediately foresee are type - how to know whether to 
> display a check box or a text area, for example - and the fact that 
> plugin authors might not want this behaviour. The former could be solved 
> by guessing, I imagine - taking "foobar" to require a text input and 
> "true" to require a check box, but that feels a little clunky. The 
> latter could just be solved with a boolean "display" field.
> 
> What do you reckon?

I recon you sould check out the manage_caps_page hook, which will allow 
plugin authors to output custom form elements on the user profile page.

New form elements there will allow plugin authors to use whatever 
controls they want (text field, checkbox, flash applet, etc.) to set 
values for what usermeta values they want to store.

The core code will probably not include a dynamic way to add new input 
controls based on teh data in the usermeta specifically for the reasons 
you outlined:  It can't know what control type you want to use, and it 
doesn't know whether to display the information at all.

For example, core user capabilities are stored as a serialized array in 
one row of the usermeta table for each user.  How does the user page 
know not to display this?  Worse yet, if it did know how to display it, 
that could allow users to edit their own permissions!

Better to leave interface elements to the plugin authors themselves for 
what usermeta info they want to store.

Owen






More information about the wp-hackers mailing list