Making WordPress.org

Changeset 10918


Ignore:
Timestamp:
04/21/2021 07:58:50 AM (4 years ago)
Author:
dd32
Message:

Support: Break a users password if they're blocked already and are being re-blocked and the password isn't broken.

Also, WP_User::has_role() is not a method, call WP_User::has_cap() instead.
See https://core.trac.wordpress.org/ticket/53066.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r10908 r10918  
    458458        } elseif ( bbp_is_single_user() ) {
    459459            // Blocked users are not indexed.
    460             if ( bbpress()->displayed_user && bbpress()->displayed_user->has_cap( 'bbp_blocked' ) ) {
     460            if ( bbpress()->displayed_user && bbpress()->displayed_user->has_cap( bbp_get_blocked_role() ) ) {
    461461                $robots = true;
    462462
     
    13161316        $note_text       = false;
    13171317
    1318         if ( $blocked_role === $new_role && ! $password_broken ) {
     1318        if (
     1319            ( $blocked_role === $new_role || $user->has_cap( $blocked_role ) ) &&
     1320            ! $password_broken
     1321        ) {
    13191322            // User has been blocked, break their password and sessions.
    13201323            // WordPress doesn't have a way to edit a user password without re-hashing it.
     
    13421345        } else if (
    13431346            $password_broken &&
    1344             ! $user->has_role( $blocked_role )
     1347            ! $user->has_cap( $blocked_role )
    13451348        ) {
    13461349            // User was blocked (broken password) but no longer is.
Note: See TracChangeset for help on using the changeset viewer.