WordPress.org

Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#48192 new enhancement

get_blogs_of_user not setting public parameter

Reported by: tifosi Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description (last modified by SergeyBiryukov)

Hello.

For multisite installations get_blogs_of_user uses get_sites to retrieve all multisite instances. This contains parameters such as archived, deleted, etc, and also the public parameter.

The get_blogs_of_user function iterates through the results of get_sites and sets the blogs array of blog objects. It matches and sets all parameters from get_sites, but omits the 'public' parameter, probably by oversight.

For example a blog from get_blogs_of_user:

 stdClass Object (
    [userblog_id] => 2
    [blogname] => Site 2
    [domain] => example.com
    [path] => /de/
    [site_id] => 1
    [siteurl] => http://example.com/de
    [archived] => 0
    [mature] => 0
    [spam] => 0
    [deleted] => 0
    [blog_id] => 2
    [description] => 2
    [language] => de_DE
) 

No way apart from using the 'get_blogs_of_user' filter to reiterate the sites and set the value.

Requires the public parameter to be set.

Attachments (1)

48192.diff (3.0 KB) - added by iCaleb 20 months ago.
Return the public property from get_blogs_of_user(). Also ensures the single-site return is an equal match. Includes tests.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
20 months ago

  • Description modified (diff)

#2 @iCaleb
20 months ago

Makes sense. Seems pretty odd that the entire WP_Site object isn't just returned from get_blogs_of_user() instead of recreating with a new array though.

All that's missing from the default properties are: registered, last_updated, public, and lang_id. Should we just add all of those?

Last edited 20 months ago by iCaleb (previous) (diff)

@iCaleb
20 months ago

Return the public property from get_blogs_of_user(). Also ensures the single-site return is an equal match. Includes tests.

#3 @iCaleb
20 months ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.