Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2024 06:19:06 PM (5 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/groups/template.php

    r13980 r14070  
    903903        // Fool the admin check
    904904        $old_user = get_current_user_id();
    905         self::set_current_user( $u2 );
     905        wp_set_current_user( $u2 );
    906906        buddypress()->is_item_admin = true;
    907907        groups_ban_member( $u1, $g2 );
    908908
    909909        // Start the groups loop
    910         self::set_current_user( $u1 );
     910        wp_set_current_user( $u1 );
    911911        if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group();
    912912            $found[] = bp_group_is_user_banned();
     
    919919        // Clean up
    920920        $GLOBALS['groups_template'] = null;
    921         self::set_current_user( $old_user );
     921        wp_set_current_user( $old_user );
    922922    }
    923923
     
    949949        // Fool the admin check
    950950        $old_user = get_current_user_id();
    951         self::set_current_user( $u2 );
     951        wp_set_current_user( $u2 );
    952952        buddypress()->is_item_admin = true;
    953953        groups_ban_member( $u1, $g2 );
     
    966966
    967967        // Clean up
    968         self::set_current_user( $old_user );
     968        wp_set_current_user( $old_user );
    969969    }
    970970
Note: See TracChangeset for help on using the changeset viewer.