WordPress.org

Make WordPress Core

#21179 closed enhancement (fixed)

filter error message displayed when a site is over quota

Reported by: jkudish Owned by: 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 22 months ago.
21179.patch (1.1 KB) - added by dllh 22 months ago.
21179.diff (888 bytes) - added by westi 22 months ago.
Simpler patch
21179.2.diff (1.9 KB) - added by SergeyBiryukov 22 months ago.

Download all attachments as: .zip

Change History (16)

jkudish22 months ago

comment:1 follow-up: scribu22 months ago

Use a translation file or the 'gettext' filter?

comment:2 in reply to: ↑ 1 jkudish22 months 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.

comment:3 follow-up: sirzooro22 months ago

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

comment:4 in reply to: ↑ 3 jkudish22 months 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

comment:5 westi22 months 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.

dllh22 months ago

comment:6 follow-up: dllh22 months 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.

westi22 months ago

Simpler patch

comment:7 in reply to: ↑ 6 westi22 months 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.

comment:8 westi22 months 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.

comment:9 westi22 months ago

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

comment:10 westi22 months 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.

SergeyBiryukov22 months ago

comment:11 SergeyBiryukov22 months 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.

comment:12 westi22 months 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.