WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#40349 closed enhancement (fixed)

Add network ID parameter to wp_update_network_user_counts()

Reported by: flixos90 Owned by: flixos90
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch has-unit-tests commit
Focuses: multisite Cc:
PR Number:

Description

While user counts are currently global, they are stored per network. At some point in the future there might be actual network user counts, and we should make sure the infrastructure is flexible enough.

Therefore I'm proposing to add a $network_id parameter to wp_update_network_user_counts(), similar as proposed in #37528.

The related function get_user_count() was enhanced in a similar way (see #37866).

Attachments (2)

40349.diff (1.5 KB) - added by flixos90 3 years ago.
40349.2.diff (2.1 KB) - added by flixos90 3 years ago.

Download all attachments as: .zip

Change History (5)

@flixos90
3 years ago

#1 @flixos90
3 years ago

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

40349.diff adds the parameter and a unit test for it.

@flixos90
3 years ago

#2 @flixos90
3 years ago

  • Keywords commit added
  • Owner set to flixos90
  • Status changed from new to assigned

40349.2.diff makes the unit tests more precise.

#3 @flixos90
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40485:

Multisite: Add $network_id parameter to wp_update_network_user_counts().

Using the new parameter, it is now possible to update the user count on a network different from the current one. While the count itself is technically a global user count and not network-wide, it is stored on each individual network, and the new parameter provides more control about where to update the count.

Fixes #40349. See #38699.

Note: See TracTickets for help on using tickets.