Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#10837 closed enhancement (fixed)

Add *_user_meta() functions

Reported by: scribu Owned by:
Priority: normal Milestone: 3.0
Component: General Version:
Severity: normal Keywords: has-patch early
Cc: Focuses:

Description

Since we have a new generic meta API, we should use it on user metadata too.

Also, the old *_usermeta() functions should be deprecated at some point.

Attachments (3)

user.php.diff (2.9 KB ) - added by scribu 17 years ago.
10837-2.diff (9.6 KB ) - added by technosailor 17 years ago.
Updates patch to 3.0. Also deprecates old *_usermeta functions in exchange for new *_user_meta() functions that use new metadata API.
10837-3.diff (19.5 KB ) - added by technosailor 17 years ago.
Eats our own dog food patch

Download all attachments as: .zip

Change History (24)

@scribu
17 years ago

#2 @scribu
17 years ago

  • Type defect (bug)enhancement

#3 @scribu
17 years ago

Also related: #9065

#4 @ryan
17 years ago

  • Keywords early added
  • Milestone 2.93.0

Good for early 3.0.

#5 @ryan
17 years ago

Can we switch some places in core to use this so we're eating our own dogfood when this goes in?

#6 @ramiy
17 years ago

  • Cc ramiy added

scribu, change the phpDoc to v3.0.

#7 @hakre
17 years ago

Replying to ramiy:

scribu, change the phpDoc to v3.0.

comitter can do when commit is done.

#8 @sirzooro
17 years ago

  • Cc sirzooro added

#9 follow-up: @arena
17 years ago

Hi all,

just to let you know,

current code to access usermeta data has the metakey value changed by the following code :

$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);

so meta_key such as 'manage-edit-comments-columns-hidden'

is stored as 'manageeditcommentscolumnshidden'

  • i believe this is why usermeta has not been changes in 2.9 .
  • patch should still change metakey value for compatibility with existing datas.

#10 follow-up: @arena
17 years ago

oh ! and missed this one :

WP Mu has only one usermeta table and a postmeta table per blog ...

so 3.0 still merging WP and WPµ ?

#11 in reply to: ↑ 9 @scribu
17 years ago

Replying to arena:

  • patch should still change metakey value for compatibility with existing datas.

No, it shouldn't. That's why we're adding a new set of functions: so that we don't have to worry about compatibility and be consistent with *_post_meta() functions.

#12 in reply to: ↑ 10 @scribu
17 years ago

Replying to arena:

oh ! and missed this one :

WP Mu has only one usermeta table and a postmeta table per blog ...

so 3.0 still merging WP and WPµ ?

I guess we should wait until after most of the merging with MU is done.

#13 @technosailor
17 years ago

The patch should still be good. The *_user_meta() functions just wrap around the relative *_metadata() functions. Compat with MS installs should be handled transparently downstream and should not block inclusion of this patch here.

#14 follow-up: @nacin
17 years ago

There's only about 60 references to the functions these would cause to be deprecated, so we can probably make the switch pretty easily.

Just a note, there is currently no add_usermeta() function, just update_usermeta().

@technosailor
17 years ago

Updates patch to 3.0. Also deprecates old *_usermeta functions in exchange for new *_user_meta() functions that use new metadata API.

#15 in reply to: ↑ 14 @technosailor
17 years ago

Replying to nacin:

There's only about 60 references to the functions these would cause to be deprecated, so we can probably make the switch pretty easily.

There's really no reason to update those 60 refs right now if using my patch. The old functions are deprecated and turned into wrappers around the new functions for BC reasons.

#16 @nacin
17 years ago

  • Resolutionfixed
  • Status newclosed

(In [13300]) Introduce *_user_meta() functions, deprecate *_usermeta() family. Fixes #10837 props scribu, technosailor.

@technosailor
17 years ago

Eats our own dog food patch

#17 @nacin
17 years ago

(In [13311]) Don't use deprecated *_usermeta() functions. Props technosailor fixes #10837

#18 @TobiasBg
17 years ago

I haven't checked or tested this, nor do I need if we should take action, but from this BP Trac report, it sounds as if [13300] could potentially break backward compatibility:
http://trac.buddypress.org/ticket/2048

#19 @nacin
17 years ago

  • Resolution fixed
  • Status closedreopened

The old *_usermeta() functions should be backwards compatible.

I'm working on a patch right now to restore the same hooks and return values. If necessary we can return the original function definitions for *_usermeta(). Getting some second eyes on this could help.

#20 @nacin
17 years ago

(In [13326]) Ensure we're back compat with return values and actions in deprecated *_usermeta() family. See #10837

#21 @nacin
17 years ago

  • Resolutionfixed
  • Status reopenedclosed

(In [13329]) Switch over to *_user_meta() syntax. The old get_usermeta() would return a string when only one value was found, get_user_meta() requires $single = true. Fixes #10837

Note: See TracTickets for help on using tickets.