Making WordPress.org

Changeset 10295


Ignore:
Timestamp:
09/29/2020 02:04:59 AM (6 years ago)
Author:
dd32
Message:

Login: REST API: Define the permission_callback as required by WordPress 5.5+, fix a PHP Notice by not treating an array as an object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-restapi.php

    r10029 r10295  
    33function wporg_login_rest_routes() {
    44        register_rest_route( 'wporg/v1', '/username-available/(?P<login>.*)', array(
    5                 'methods'  => WP_REST_Server::READABLE,
    6                 'callback' => 'wporg_login_rest_username_exists'
     5                'methods'             => WP_REST_Server::READABLE,
     6                'callback'            => 'wporg_login_rest_username_exists',
     7                'permission_callback' => '__return_true',
    78        ) );
    89        register_rest_route( 'wporg/v1', '/username-available/?', array(
    9                 'methods'  => WP_REST_Server::READABLE,
    10                 'callback' => 'wporg_login_rest_username_exists'
     10                'methods'             => WP_REST_Server::READABLE,
     11                'callback'            => 'wporg_login_rest_username_exists',
     12                'permission_callback' => '__return_true',
    1113        ) );
    1214
    1315        register_rest_route( 'wporg/v1', '/email-in-use/(?P<email>.*)', array(
    14                 'methods'  => WP_REST_Server::READABLE,
    15                 'callback' => 'wporg_login_rest_email_in_use'
     16                'methods'             => WP_REST_Server::READABLE,
     17                'callback'            => 'wporg_login_rest_email_in_use',
     18                'permission_callback' => '__return_true',
    1619        ) );
    1720        register_rest_route( 'wporg/v1', '/email-in-use/?', array(
    18                 'methods'  => WP_REST_Server::READABLE,
    19                 'callback' => 'wporg_login_rest_email_in_use'
     21                'methods'             => WP_REST_Server::READABLE,
     22                'callback'            => 'wporg_login_rest_email_in_use',
     23                'permission_callback' => '__return_true',
    2024        ) );
    2125
    2226        register_rest_route( 'wporg/v1', '/resend-confirmation-email/?', array(
    23                 'methods'  => WP_REST_Server::EDITABLE,
    24                 'callback' => 'wporg_login_rest_resend_confirmation_email'
     27                'methods'             => WP_REST_Server::EDITABLE,
     28                'callback'            => 'wporg_login_rest_resend_confirmation_email',
     29                'permission_callback' => '__return_true',
    2530        ) );
    2631}
    … …  
    4954                                __( 'The registration is still pending, please check your email for the confirmation link.', 'wporg' ) . '<br>' .
    5055                                '<a href="#" class="resend">' . __( 'Resend confirmation email.', 'wporg' ) . '</a>',
    51                         'avatar' => get_avatar( $pending->user_email, 64 ),
     56                        'avatar' => get_avatar( $pending['user_email'], 64 ),
    5257                ];
    5358        }
Note: See TracChangeset for help on using the changeset viewer.