From 4afa19184a25cfecf28899436123044f7d2be3b6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 19 Nov 2016 01:06:30 +0000 Subject: [PATCH] REST API: After [39302], clarify `author_ip` parameter in error message. Properties of objects should not be translated, and therefore are pulled out of the translation strings. Props ramiy. Fixes #38822. Built from https://develop.svn.wordpress.org/trunk@39306 git-svn-id: http://core.svn.wordpress.org/trunk@39246 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-rest-comments-controller.php | 20 ++++++++++++++----- wp-includes/version.php | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index a04ec8234a..021378d91c 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -373,19 +373,29 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { // Limit who can set comment `author`, `author_ip` or `status` to anything other than the default. if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) { - /* translators: %s: request parameter */ - return new WP_Error( 'rest_comment_invalid_author', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_comment_invalid_author', + /* translators: %s: request parameter */ + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ), + array( 'status' => rest_authorization_required_code() ) + ); } if ( isset( $request['author_ip'] ) && ! current_user_can( 'moderate_comments' ) ) { if ( empty( $_SERVER['REMOTE_ADDR'] ) || $request['author_ip'] !== $_SERVER['REMOTE_ADDR'] ) { - return new WP_Error( 'rest_comment_invalid_author_ip', __( 'Sorry, you are not allowed to set author_ip for comments.' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_comment_invalid_author_ip', + /* translators: %s: request parameter */ + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments.", 'author_ip' ) ), + array( 'status' => rest_authorization_required_code() ) + ); } } if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) { - /* translators: %s: request parameter */ - return new WP_Error( 'rest_comment_invalid_status', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'rest_comment_invalid_status', + /* translators: %s: request parameter */ + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ), + array( 'status' => rest_authorization_required_code() ) + ); } if ( empty( $request['post'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index d4b5104a05..8c27ab6e32 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta4-39305'; +$wp_version = '4.7-beta4-39306'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.