Skip to content

Commit

Permalink
General: Further improve error messages following [42648].
Browse files Browse the repository at this point in the history
Props kristastevens, melchoyce.
Fixes #38332 for trunk.


Built from https://develop.svn.wordpress.org/trunk@42719


git-svn-id: http://core.svn.wordpress.org/trunk@42547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
peterwilsoncc committed Feb 19, 2018
1 parent 5eddf9a commit e6ccdf1
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions wp-admin/custom-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ public function step_2() {
check_admin_referer( 'custom-header-upload', '_wpnonce-custom-header-upload' );
if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
403
);
Expand Down Expand Up @@ -922,15 +922,15 @@ public function step_3() {

if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
403
);
}

if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The current theme does not support a flexible sized header image.' ) . '</p>',
403
);
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if ( ! current_user_can( 'customize' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
403
);
Expand All @@ -31,7 +31,7 @@

if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
403
);
Expand Down Expand Up @@ -76,7 +76,7 @@

if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
403
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_once( dirname( __FILE__ ) . '/admin.php' );
if ( ! current_user_can( 'edit_posts' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>',
403
);
Expand Down
10 changes: 5 additions & 5 deletions wp-admin/edit-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

if ( ! current_user_can( $tax->cap->manage_terms ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
403
);
Expand Down Expand Up @@ -81,7 +81,7 @@

if ( ! current_user_can( $tax->cap->edit_terms ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
403
);
Expand Down Expand Up @@ -111,7 +111,7 @@

if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
403
);
Expand All @@ -131,7 +131,7 @@

if ( ! current_user_can( $tax->cap->delete_terms ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
403
);
Expand Down Expand Up @@ -167,7 +167,7 @@

if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function add_link() {
function edit_link( $link_id = 0 ) {
if ( ! current_user_can( 'manage_links' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ function wp_edit_theme_plugin_file( $args ) {
}

if ( ! isset( $result['message'] ) ) {
$message = __( 'An error has occurred.' );
$message = __( 'Something went wrong.' );
} else {
$message = $result['message'];
unset( $result['message'] );
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/media-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
// Require an ID for the edit screen.
if ( isset( $action ) && $action == 'edit' && ! $ID ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'Invalid item ID.' ) . '</p>',
403
);
}

if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post', $_REQUEST['post_id'] ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/nav-menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// Permissions Check
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
// If the user doesn't already belong to the blog, bail.
if ( ! is_user_member_of_blog( $user_id ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

if ( ! current_user_can( $capability ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to manage these options.' ) . '</p>',
403
);
Expand Down Expand Up @@ -74,7 +74,7 @@

if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/post-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/press-this.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function wp_load_press_this() {
if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
wp_die(
__( 'Sorry, you are not allowed to create posts as this user.' ),
__( 'You don&#8217;t have permission to do this.' ),
__( 'You need a higher level of permission.' ),
403
);
} elseif ( is_plugin_active( $plugin_file ) ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/term.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
! current_user_can( 'edit_term', $tag->term_id ) ) {

wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
403
);
Expand Down
8 changes: 4 additions & 4 deletions wp-admin/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
403
);
Expand All @@ -24,7 +24,7 @@

if ( ! $theme->exists() || ! $theme->is_allowed() ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
403
);
Expand All @@ -39,15 +39,15 @@

if ( ! current_user_can( 'delete_themes' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
403
);
}

if ( ! $theme->exists() ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
403
);
Expand Down
8 changes: 4 additions & 4 deletions wp-admin/user-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
if ( is_multisite() ) {
if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
403
);
}
} elseif ( ! current_user_can( 'create_users' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
403
);
Expand Down Expand Up @@ -52,7 +52,7 @@

if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
403
);
Expand Down Expand Up @@ -136,7 +136,7 @@

if ( ! current_user_can( 'create_users' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
403
);
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

if ( ! current_user_can( 'list_users' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to list users.' ) . '</p>',
403
);
Expand Down Expand Up @@ -141,7 +141,7 @@
// If the user doesn't already belong to the blog, bail.
if ( is_multisite() && ! is_user_member_of_blog( $id ) ) {
wp_die(
'<h1>' . __( 'An error has occurred.' ) . '</h1>' .
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
403
);
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ protected function wp_die( $ajax_message, $message = null ) {
}

if ( ! $message ) {
$message = __( 'An error has occurred.' );
$message = __( 'Something went wrong.' );
}

if ( $this->messenger_channel ) {
Expand Down Expand Up @@ -512,7 +512,7 @@ public function setup_theme() {
auth_redirect();
} else {
wp_die(
'<h1>' . __( 'You don&#8217;t have permission to do this.' ) . '</h1>' .
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,7 @@ public function wp_newComment( $args ) {
}

if ( ! $comment_ID ) {
return new IXR_Error( 403, __( 'An error has occurred.' ) );
return new IXR_Error( 403, __( 'Something went wrong.' ) );
}

/**
Expand Down
14 changes: 7 additions & 7 deletions wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,11 @@ function wp_get_http_headers( $url, $deprecated = false ) {
/**
* Determines whether the publish date of the current post in the loop is different
* from the publish date of the previous post in the loop.
*
*
* For more information on this and similar theme functions, check out
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* Conditional Tags} article in the Theme Developer Handbook.
*
*
* @since 0.71
*
* @global string $currentday The day of the current post in the loop.
Expand Down Expand Up @@ -1393,9 +1393,9 @@ function do_robots() {
* cache, and the database goes away, then you might have problems.
*
* Checks for the 'siteurl' option for whether WordPress is installed.
*
*
* For more information on this and similar theme functions, check out
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* Conditional Tags} article in the Theme Developer Handbook.
*
* @since 2.1.0
Expand Down Expand Up @@ -2727,7 +2727,7 @@ function wp_nonce_ays( $action ) {
wp_logout_url( $redirect_to )
);
} else {
$html = __( 'The link you followed no longer exists.' );
$html = __( 'The link you followed has expired.' );
if ( wp_get_referer() ) {
$html .= '</p><p>';
$html .= sprintf(
Expand All @@ -2738,7 +2738,7 @@ function wp_nonce_ays( $action ) {
}
}

wp_die( $html, __( 'An error has occurred.' ), 403 );
wp_die( $html, __( 'Something went wrong.' ), 403 );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/wp-ajax-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var wpAjax = jQuery.extend( {
selector = jQuery( selector );
return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() === ''; } ) ).length;
}
}, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'An error has occurred.' } );
}, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'Something went wrong.' } );

// Basic form validation
jQuery(document).ready( function($){
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/wp-ajax-response.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6ccdf1

Please sign in to comment.