WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#33684 closed enhancement (fixed)

Cheatin' uh?: Update in wp-includes/class-wp-customize-manager.php

Reported by: kraftbj Owned by: SergeyBiryukov
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: has-patch
Focuses: ui Cc:

Description

Spin off of #14530 to track updating the Cheatin error message to something context specific. Patch needs to be split off of original ticket.

Attachments (3)

33684.diff (1.5 KB) - added by kraftbj 2 years ago.
initial patch
Screen Shot 2015-09-02 at 17.23.24.png (11.2 KB) - added by kraftbj 2 years ago.
sample of the dynamic error response.
33684.2.diff (1.6 KB) - added by kraftbj 2 years ago.
add translation functions

Download all attachments as: .zip

Change History (12)

@kraftbj
2 years ago

initial patch

#1 @kraftbj
2 years ago

  • Keywords has-patch added

This file has a custom wp_die handler, so I applied the logic and spirit of #14530 like this:

  • "Upstream" from the actual wp_die call, I added error messages to each instance of the class' wp_die function.
  • For the generic theme error return, I used $this->theme()->errors()->get_error_message(). To follow the chain, the class' theme() calls wp_get_theme, which is a WP_Theme object. WP_Theme::errors() returns the WP_Error object, so get_error_message returns the pretty error message.

An example to test that error message:

  1. WordPress install with multiple themes installed. Access the Customizer. Preview theme A.
  2. From another window, delete theme B.
  3. From the original window, attempt to Live Preview theme A.

The result will be the attached screenshot.

@kraftbj
2 years ago

sample of the dynamic error response.

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 4.4

#3 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 33889:

Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-includes/class-wp-customize-manager.php.

props kraftbj.
fixes #33684. see #14530.

#4 @GaryJ
2 years ago

Do wp_die() messages need to be translatable? If we're going to be giving messages that pertain to being more useful to the user that caused them, then being able to have those messages in the user's desired language has got to be a necessity?

#5 @GaryJ
2 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening, as I've now seen that sibling commits do indeed have translatable strings, which simply got missed for this ticket.

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


2 years ago

#7 @kraftbj
2 years ago

The upstream error messages should already be translated, but I did overlook that when adding these. Patch incoming.

@kraftbj
2 years ago

add translation functions

#8 @kraftbj
2 years ago

  • Keywords has-patch added; needs-patch removed

#9 @SergeyBiryukov
2 years ago

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

In 33892:

Add missing translation functions to the error messages added in [33889].

props kraftbj, GaryJ.
fixes #33684.

Note: See TracTickets for help on using tickets.