Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2024 06:19:06 PM (11 months ago)
Author:
espellcaste
Message:

A user is no longer de-authenticated when making REST API requests.

We are introducing a new BP_LoggedIn_User class to fetch data about a BuddyPress logged-in user. This new addition fixes an issue where a user could be de-authenticated when making REST API requests.

Props dcavins, DJPaul, johnjamesjacoby, and imath.

Closes https://github.com/buddypress/buddypress/pull/395
See #9229 and #9145
Fixes #7658

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/members/test-member-avatar-controller.php

    r14026 r14070  
    3939        $u1 = $this->bp::factory()->user->create();
    4040
    41         $this->bp::set_current_user( $u1 );
     41        wp_set_current_user( $u1 );
    4242
    4343        $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d/avatar', $u1 ) );
     
    103103        $reset_post  = $_POST;
    104104
    105         $this->bp::set_current_user( $this->user );
     105        wp_set_current_user( $this->user );
    106106
    107107        add_filter( 'pre_move_uploaded_file', array( $this, 'copy_file' ), 10, 3 );
     
    166166     */
    167167    public function test_create_item_with_upload_disabled() {
    168         $this->bp::set_current_user( $this->user );
     168        wp_set_current_user( $this->user );
    169169
    170170        // Disabling member avatar upload.
     
    181181     */
    182182    public function test_create_item_empty_image() {
    183         $this->bp::set_current_user( $this->user );
     183        wp_set_current_user( $this->user );
    184184
    185185        $request = new WP_REST_Request( 'POST', sprintf( $this->endpoint_url . '/%d/avatar', $this->user ) );
     
    205205        $u1 = $this->bp::factory()->user->create();
    206206
    207         $this->bp::set_current_user( $u1 );
     207        wp_set_current_user( $u1 );
    208208
    209209        $request = new WP_REST_Request( 'POST', sprintf( $this->endpoint_url . '/%d/avatar', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) );
     
    231231     */
    232232    public function test_delete_item_failed() {
    233         $this->bp::set_current_user( $this->user );
     233        wp_set_current_user( $this->user );
    234234
    235235        $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d/avatar', $this->user ) );
Note: See TracChangeset for help on using the changeset viewer.