Making WordPress.org

Changeset 12146


Ignore:
Timestamp:
10/21/2022 07:16:19 AM (3 years ago)
Author:
dd32
Message:

Support Forums: Allow moderators to view anonymised profiles.

File:
1 edited

Legend:

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

    r12094 r12146  
    2323        add_filter( 'wp_insert_post_data',             array( $this, 'set_post_date_gmt_for_pending_posts' ) );
    2424        add_action( 'wp_print_footer_scripts',         array( $this, 'replace_quicktags_blockquote_button' ) );
     25        add_filter( 'bbp_show_user_profile',           array( $this, 'allow_mods_to_view_inactive_users' ), 10, 2 );
    2526
    2627        // Add bbPress support to the WordPress.org SEO plugin.
     
    231232
    232233        return $caps;
     234    }
     235
     236    /**
     237     * Allow moderators to view anonymized user account details.
     238     */
     239    function allow_mods_to_view_inactive_users( $filter_value, $user_id ) {
     240        if (
     241            ! $filter_value &&
     242            bbp_is_user_inactive( $user_id ) &&
     243            current_user_can( 'moderate' )
     244        ) {
     245            $filter_value = true;
     246        }
     247
     248        return $filter_value;
    233249    }
    234250
Note: See TracChangeset for help on using the changeset viewer.