Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#23192 closed enhancement (fixed)

Use get_user_by() in is_user_spammy()

Reported by: ocean90's profile ocean90 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: normal Version:
Component: Multisite Keywords: has-patch commit needs-unit-tests
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Comes up after reading #23190.

Since is_user_spammy expects a user name, we should replace get_user_id_from_string( $username ) with get_user_by( 'login', $username ). Same for the id.

Attachments (3)

23192.patch (826 bytes) - added by ocean90 11 years ago.
23192-ut.patch (767 bytes) - added by bananastalktome 11 years ago.
23192.1.patch (1.0 KB) - added by bananastalktome 11 years ago.
also update function inline docs to reflect change

Download all attachments as: .zip

Change History (11)

11 years ago

#1 @ocean90
11 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
11 years ago

  • Description modified (diff)
  • Keywords 2nd-opinion removed
  • Milestone changed from Awaiting Review to 3.6

I agree. We could then deprecate get_user_id_from_string(), since it's the only instance in core.

#3 @SergeyBiryukov
11 years ago

  • Keywords commit added

#4 @ryan
11 years ago

  • Keywords needs-unit-tests added

Looks good. Let's add some simple unit tests.

#5 @bananastalktome
11 years ago

  • Cc bananastalktome@… added

Does this test look sufficient?

11 years ago

also update function inline docs to reflect change

#6 @SergeyBiryukov
11 years ago

In 1216/tests:

Test that is_user_spammy() properly recognizes a numeric username. props bananastalktome. see #23192. see #23190.

#7 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 23431:

Replace get_user_id_from_string() with get_user_by(). props ocean90, bananastalktome. fixes #23192. see #23190.

#8 @SergeyBiryukov
11 years ago

In 23432:

Use wp_get_current_user(). props nacin. see #23192.

Note: See TracTickets for help on using tickets.