[wp-trac] Re: [WordPress Trac] #7540: allow multiple values for key
in usermeta
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 21 11:28:06 GMT 2009
#7540: allow multiple values for key in usermeta
-------------------------+--------------------------------------------------
Reporter: wnorris | Type: enhancement
Status: new | Priority: normal
Milestone: 2.8 | Component: Users
Version: 2.6.1 | Severity: normal
Keywords: needs-patch |
-------------------------+--------------------------------------------------
Comment(by Denis-de-Bernardy):
in the patch I uploaded, the various *_user_meta() functions do not behave
exactly the same as the *_usermeta() functions. but it's mostly to get a
2nd opinion on the method.
usage would be as follows for single-key options:
{{{
add_user_meta($user_id, 'foo', 'bar', true);
get_user_meta($user_id, 'foo');
update_user_meta($user_id, 'foo', 'bar');
delete_user_meta($user_id, 'foo');
}}}
and for multi-key options:
{{{
add_user_meta($user_id, 'foo', 'bar');
get_user_meta($user_id, 'foo');
update_user_meta($user_id, 'foo', 'bar', 'old');
delete_user_meta($user_id, 'foo', 'old');
}}}
in other words, the meta key would have to be initially declared as multi-
key, else it'll get treated (always) as a single key.
one very questionable option I took is in update_user_meta(): it assumes
that anything passed *with* a previous value will be a multi-key option;
and anything without one is a single-key option.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/7540#comment:21>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list