Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#32907 closed defect (bug) (fixed)

We should pass the site ID to the 'wpmu_update_blog_options' action

Reported by: drewapicture's profile DrewAPicture Owned by: jeremyfelt's profile jeremyfelt
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.0
Component: Options, Meta APIs Keywords: good-first-bug has-patch commit
Focuses: multisite Cc:

Description

The wpmu_update_blog_options hook was added following the MU merge in 3.0 along with the wpmueditblogaction hook.

The suggestion is that we should match the style of the latter and pass the site ID even though it's easily accessible via get_current_blog_id() where the wpmu_update_blog_options hook fires.

Might as well also fix the docs alignment while we're in there too.

https://core.trac.wordpress.org/browser/trunk/src/wp-admin/network/site-settings.php#L61

Attachments (3)

32907.patch (844 bytes) - added by swissspidy 11 years ago.
Add $blog_id parameter
32907.2.patch (816 bytes) - added by swissspidy 11 years ago.
32907.3.diff (762 bytes) - added by MikeHansenMe 10 years ago.
update the docs @since version

Download all attachments as: .zip

Change History (16)

@swissspidy
11 years ago

Add $blog_id parameter

@swissspidy
11 years ago

#1 @swissspidy
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Version set to 3.0

#2 @DrewAPicture
11 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

#3 @sc0ttkclark
11 years ago

+1 on this

#4 @sc0ttkclark
11 years ago

The patch is good too, I say commit :)

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


11 years ago

#6 @swissspidy
11 years ago

  • Milestone changed from Awaiting Review to Future Release

Too late for 4.3 I guess.

#7 @swissspidy
11 years ago

  • Keywords commit 4.4-early added

#8 follow-ups: @jeremyfelt
11 years ago

I don't have strong feelings, though it would be nice to find another example of a hook in core where an ID was passed that was readily available through something like get_current_blog_id().

#9 in reply to: ↑ 8 @DrewAPicture
11 years ago

Replying to jeremyfelt:

I don't have strong feelings, though it would be nice to find another example of a hook in core where an ID was passed that was readily available through something like get_current_blog_id().

A quick search shows a few filters that pass easily-accessible values:

apply_filters( 'all_plugins', get_plugins() );
apply_filters( 'the_content', get_the_content() );
apply_filters( 'the_permalink_rss', get_permalink() );
apply_filters( 'the_excerpt', get_the_excerpt() );
apply_filters( 'core_version_check_locale', get_locale() );

And so on. No actions though that I'm seeing with my rudimentary RegEx.

#10 in reply to: ↑ 8 ; follow-up: @swissspidy
10 years ago

  • Focuses docs added

Replying to jeremyfelt:

I don't have strong feelings, though it would be nice to find another example of a hook in core where an ID was passed that was readily available through something like get_current_blog_id().

In the same file $id is passed to the wpmueditblogaction action. Since $id is already available, I don't really see a benefit of using get_current_blog_id() instead. But there's a patch for either scenario.

#11 in reply to: ↑ 10 @jeremyfelt
10 years ago

  • Keywords 4.4-early removed
  • Milestone changed from Future Release to 4.4
  • Owner changed from swissspidy to jeremyfelt
  • Status changed from assigned to reviewing

Replying to swissspidy:

In the same file $id is passed to the wpmueditblogaction action. Since $id is already available, I don't really see a benefit of using get_current_blog_id() instead. But there's a patch for either scenario.

Yeah, I was thinking more along the lines of whether passing the ID was necessary because you can use get_current_blog_id() in your hooked function because things are currently switched. We have to pass $id to wpmueditblogaction because things are back to the network's site context.

I do think the argument for clarity works as it would unify the two a bit. I'll take a look at getting this in.

#12 @DrewAPicture
10 years ago

  • Focuses docs removed

@MikeHansenMe
10 years ago

update the docs @since version

#13 @jeremyfelt
10 years ago

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

In 33918:

Multisite: Pass the ID of the site being updated to wpmu_update_blog_options action.

Props @swissspidy, @MikeHansenMe.
Fixes #32907.

Note: See TracTickets for help on using tickets.