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/src/bp-members/classes/class-bp-members-component.php

    r14059 r14070  
    234234        $user_id = bp_loggedin_user_id();
    235235
    236         /** Logged in user ***************************************************
    237          */
    238 
    239         // The core userdata of the user who is currently logged in.
    240         $bp->loggedin_user->userdata = bp_core_get_core_userdata( $user_id );
    241 
    242         // Fetch the full name for the logged in user.
    243         $bp->loggedin_user->fullname = isset( $bp->loggedin_user->userdata->display_name ) ? $bp->loggedin_user->userdata->display_name : '';
    244 
    245         // Hits the DB on single WP installs so get this separately.
    246         $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( $user_id );
    247 
    248         // The domain for the user currently logged in. eg: http://example.com/members/andy.
    249         $bp->loggedin_user->domain = bp_members_get_user_url( $user_id );
    250 
    251236        /**
    252237         * Set the Displayed user for the classic BuddyPress. This should only be the case when the
     
    255240         */
    256241        if ( bp_displayed_user_id() ) {
    257             // We're viewing a speciific user, switch the ID to use for the Nav to this one.
     242            // We're viewing a specific user, switch the ID to use for the Nav to this one.
    258243            $user_id = bp_displayed_user_id();
    259244
Note: See TracChangeset for help on using the changeset viewer.