[wp-hackers] Question about get_user_meta update_user_meta

Andrew Nacin wp at andrewnacin.com
Sun Dec 12 05:28:33 UTC 2010


On Sat, Dec 11, 2010 at 1:43 PM, Philip M. Hofer (Frumph) <philip at frumph.net
> wrote:

> I have been using update_usermeta and get_usermeta because sometimes the
> string comes back empty and i'm totally lost on it's usage.
>
> Basically I have
> get_user_meta($current_user->ID,'comicpress-is-member', true);
>
> to get the user meta is-member tag
>
> and updating
>
> update_user_meta($id, 'comicpress-is-member', $comicpress_is_member);
>
> where id = (int)$_POST['user_id'])  in my save filter.
>
>
>
> The problem is my understanding with WPMS, does this flag carry over to all
> blogs? or just the main one, i'm a little lost on this one after reading the
> conversation  in the list recently.
>
> Basically I want to get and store the information on the main blog but have
> it available and used on all subblogs as well.
>

get_user_meta gets stored in the global usermeta table without a prefix, so
yes, it would be for all blogs.

For others on the list, if you *do* want this to be per-blog, on the other
hand, the trick is to key it with the database prefix. But *don't* do that
on your own -- use get_user_option() and friends, which will do it for you.

Nacin


More information about the wp-hackers mailing list