Make WordPress Core

Opened 9 years ago

Closed 5 years ago

Last modified 5 years ago

#43339 closed enhancement (fixed)

Global user_options calls should use user_meta instead

Reported by: johnjamesjacoby Owned by: zkancs
Priority: normal Milestone: 5.8
Component: General Version:
Severity: normal Keywords: 2nd-opinion good-first-bug has-patch
Cc: Focuses:

Description

There are 2 places where WordPress uses the user_option functions with the global flag set to true which internally invokes the user_meta functions.

In these cases, there is no benefit to using user_option and only a detriment by way of additional function calls.

The user-meta keys in question are:

  • default_password_nag
  • community-events-location

Attachments (4)

43339.diff​ (4.8 KB ) - added by zkancs 9 years ago.
Use update_user_meta instead of update_user_option
43339.2.diff​ (4.8 KB ) - added by zkancs 9 years ago.
43339.3.diff​ (10.4 KB ) - added by zkancs 9 years ago.
43339.4.diff​ (8.2 KB ) - added by zkancs 9 years ago.

Download all attachments as: .zip

Change History (17)

#1 @obenland
9 years ago

  • Owner set to zkancs
  • Status new → assigned

@zkancs
9 years ago

Use update_user_meta instead of update_user_option

@zkancs
9 years ago

#2 @obenland
9 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone Awaiting Review → 5.0

#3 @obenland
9 years ago

It looks like there are some more instances where update_user_option is used with $global set to true. Doe we want to change those too?

#4 @zkancs
9 years ago

@obenland Yes, I'll change the rest of them.

@zkancs
9 years ago

#5 @zkancs
9 years ago

There're some mistakes in the HTML I've made. Fixing them.

@zkancs
9 years ago

#6 @zkancs
9 years ago

@obenland Fixed. I think I've changed every place where update_user_option is used with $global set to true. Please review again.

#7 @johnbillion
8 years ago

  • Milestone 5.0 → 5.1

#8 @pento
8 years ago

  • Keywords needs-refresh added
  • Milestone 5.1 → Future Release

43339.4.diff​ needs updating to apply to trunk.

This ticket was mentioned in ​Slack in #core by jjj. ​View the logs.


6 years ago

#10 @SergeyBiryukov
6 years ago

  • Milestone Future Release → 5.8

This ticket was mentioned in ​PR #1244 on ​WordPress/wordpress-develop by ​desrosj.


5 years ago
#11

  • Keywords needs-refresh removed

#12 @desrosj
5 years ago

  • Resolution → fixed
  • Status assigned → closed

In 50981:

General: Avoid unnecessary calls to update_user_option().

The update_user_option() function is a way to update a user meta value after adding a blog’s prefix to the beginning of the meta key. But when the fourth parameter is true, the behavior is exactly the same as calling update_user_meta() directly.

This replaces all instances of update_user_option() when the fourth parameter is true in Core with a direct call to update_user_meta() to prevent an unnecessary call to update_user_option().

Props johnjamesjacoby, zkancs, obenland, desrosj.
Fixes #43339.

Note: See TracTickets for help on using tickets.