Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21179 closed enhancement (fixed)

filter error message displayed when a site is over quota

Reported by: jkudish's profile jkudish Owned by: westi's profile westi
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Media Keywords: has-patch
Focuses: Cc:

Description

Add a new filter for the message that is displayed when omitting the upload form for a site that has exceeded its upload quota

Attachments (4)

21179-1.diff (627 bytes) - added by jkudish 12 years ago.
21179.patch (1.1 KB) - added by dllh 12 years ago.
21179.diff (888 bytes) - added by westi 12 years ago.
Simpler patch
21179.2.diff (1.9 KB) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (16)

@jkudish
12 years ago

#1 follow-up: @scribu
12 years ago

Use a translation file or the 'gettext' filter?

#2 in reply to: ↑ 1 @jkudish
12 years ago

Replying to scribu:

Use a translation file or the 'gettext' filter?

That would constrain me to displaying a single paragraph and to what's inside the spintf, what if I want to display something completely different there? In this case, we want to improve the user experience for our users by displaying a little bit more than a single sentence.

#3 follow-up: @sirzooro
12 years ago

You can put `</p><p>' sequence in the middle of text - this way you will be able to create more paragraphs.

#4 in reply to: ↑ 3 @jkudish
12 years ago

Replying to sirzooro:

You can put `</p><p>' sequence in the middle of text - this way you will be able to create more paragraphs.

Yes I could. But quite frankly doing a gettext filter + this hack is well, very hacky. Adding a filter is easy and others can benefit too

#5 @westi
12 years ago

I think that a better solution here is to move the current message into a function which is hooked onto an action that is fired here so that the output can easily be suppressed / augmented by a plugin without relying on using the gettext filters.

We could probably move the check onto the pre-upload-ui action with a high priority instead of introducing a new action.

@dllh
12 years ago

#6 follow-up: @dllh
12 years ago

  • Cc daryl@… added

21179.patch implements westi's proposed solution, with one twist. Since the original code does a return inline if multisite and no space left and actions can't really do returns, I've also added a filter that'll do the inline return if true. The function we fire on pre-upload-ui then applies the filter with a __return_true value. Not sure this is the best approach, but it's the only sane way I could think of short of just using a filter inside the current check.

@westi
12 years ago

Simpler patch

#7 in reply to: ↑ 6 @westi
12 years ago

Replying to dllh:

21179.patch implements westi's proposed solution, with one twist. Since the original code does a return inline if multisite and no space left and actions can't really do returns, I've also added a filter that'll do the inline return if true. The function we fire on pre-upload-ui then applies the filter with a __return_true value. Not sure this is the best approach, but it's the only sane way I could think of short of just using a filter inside the current check.

I forgot about the return complicating things so I think the best thing is an action inside the if like in the latest patch which makes this simple to override with a remove action call.

#8 @westi
12 years ago

Before commit I need to move the location of the add_action call as it it too late to be easily removed in the patch.

#9 @westi
12 years ago

  • Milestone changed from Awaiting Review to 3.5
  • Owner set to westi
  • Status changed from new to accepted

#10 @westi
12 years ago

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

In [21256]:

Multisite: Make it easy to replace or augment the over-quota message displayed when you try and upload new media and you have reached your quota.

Fixes #21179 props dllh, jkudish.

#11 @SergeyBiryukov
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The new function seems a bit out of place between media_upload_flash_bypass() and media_upload_html_bypass().

21179.2.diff moves multisite_over_quota_message() to the end of the file and adds PHPDocs for it and for the nearby functions. Also fixes @since for media_upload_max_image_resize(), which was introduced in 3.3 ([18482]), not in 2.6.

#12 @westi
12 years ago

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

In [21260]:

Multisite: Tidy up [21256] and introduce/correct PHPDoc for a few other media upload functions.

Fixes #21179 props SergeyBiryukov.

Note: See TracTickets for help on using tickets.