WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 4 months ago

#32234 new enhancement

Streamline parameter order of get_user_option()

Reported by: mechter Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2.1
Component: Users Keywords:
Focuses: Cc:

Description

get_user_meta() expects $user_id, followed by $meta_key. So do update_user_meta(), delete_user_meta(), update_user_option() and delete_user_option().

get_user_option() sticks out in that it expects these parameters in reversed order, which just caused me some major frustration even though I had looked it up before.

To enable backwards compability, we could test which of the two parameters is an integer and then swap them if necessary (unless of course meta keys can be integers too, I have not checked that, but it seems unlikely).

Change History (4)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Users

#2 @JohnOlek
19 months ago

This just caused me some frustration too and I would love to see this updated for consistency.

#3 @johnjamesjacoby
4 months ago

Just ran into this.

I'm +1 to fixing this and handling the juggle inside of get_user_option().

#4 @johnbillion
4 months ago

This is annoying but fixing it reliably might be difficult. The meta key could be an integer (unlikely) and the user ID could be a numeric string.

Note: See TracTickets for help on using tickets.