- Timestamp:
- 11/21/2016 05:31:07 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r39321 r39327 367 367 */ 368 368 public function create_item_permissions_check( $request ) { 369 370 if ( ! is_user_logged_in() && get_option( 'comment_registration' ) ) { 371 return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) ); 369 if ( ! is_user_logged_in() ) { 370 if ( get_option( 'comment_registration' ) ) { 371 return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) ); 372 } 373 374 /** 375 * Filter whether comments can be created without authentication. 376 * 377 * Enables creating comments for anonymous users. 378 * 379 * @since 4.7.0 380 * 381 * @param bool $allow_anonymous Whether to allow anonymous comments to 382 * be created. Default `false`. 383 * @param WP_REST_Request $request Request used to generate the 384 * response. 385 */ 386 $allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request ); 387 if ( false === $allow_anonymous ) { 388 return new WP_Error( 'rest_comment_login_required', __( 'Sorry, you must be logged in to comment.' ), array( 'status' => 401 ) ); 389 } 372 390 } 373 391
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)