Skip to:
Content

BuddyPress.org

Changeset 12698


Ignore:
Timestamp:
07/31/2020 02:26:38 PM (6 months ago)
Author:
boonebgorges
Message:

Remove 'whitelist' and 'blacklist' language from moderation checks.

This is part of a series of changes meant to promote clarity and
inclusiveness in the language used in our codebase.

See #8339.

Location:
trunk/src
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r12694 r12698  
    400400                     */
    401401                    remove_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2 );
    402                     remove_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys', 2 );
     402                    remove_action( 'bp_activity_before_save', 'bp_activity_check_disallowed_keys', 2 );
    403403
    404404                    bp_activity_mark_as_ham( $activity );
  • trunk/src/bp-activity/bp-activity-filters.php

    r12694 r12698  
    118118// Activity stream moderation.
    119119add_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2, 1 );
    120 add_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys',  2, 1 );
     120add_action( 'bp_activity_before_save', 'bp_activity_check_disallowed_keys',  2, 1 );
    121121
    122122/** Functions *****************************************************************/
     
    173173 * Mark the posted activity as spam, if it contains disallowed keywords.
    174174 *
    175  * @since 1.6.0
     175 * @since 7.0.0
    176176 *
    177177 * @param BP_Activity_Activity $activity The activity object to check.
    178178 */
    179 function bp_activity_check_blacklist_keys( $activity ) {
     179function bp_activity_check_disallowed_keys( $activity ) {
    180180
    181181    // Only check specific types of activity updates.
     
    186186    // Send back the error so activity update fails.
    187187    // @todo This is temporary until some kind of trash status is built.
    188     $blacklist = bp_core_check_for_blacklist( $activity->user_id, '', $activity->content, 'wp_error' );
    189     if ( is_wp_error( $blacklist ) ) {
    190         $activity->errors = $blacklist;
     188    $disallowed = bp_core_check_for_disallowed_keys( $activity->user_id, '', $activity->content, 'wp_error' );
     189    if ( is_wp_error( $disallowed ) ) {
     190        $activity->errors = $disallowed;
    191191
    192192        // Backpat.
  • trunk/src/bp-core/bp-core-moderation.php

    r12694 r12698  
    188188 * Check for blocked keys.
    189189 *
    190  * @since 1.6.0
    191  * @since 2.6.0 Added $error_type parameter.
    192  *
    193  * @todo Why don't we use wp_blacklist_check() for this?
     190 * @since 7.0.0
    194191 *
    195192 * @param int    $user_id    User ID.
     
    199196 * @return bool|WP_Error True if test is passed, false if fail.
    200197 */
    201 function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '', $error_type = 'bool' ) {
     198function bp_core_check_for_disallowed_keys( $user_id = 0, $title = '', $content = '', $error_type = 'bool' ) {
    202199
    203200    /**
     
    205202     *
    206203     * @since 2.2.0
     204     * @deprecated 7.0.0 Use 'bp_bypass_check_for_disallowed_keys' instead.
    207205     *
    208206     * @param bool   $value   Whether or not to bypass checking. Default false.
     
    211209     * @param string $content $the content being posted.
    212210     */
    213     if ( apply_filters( 'bp_bypass_check_for_blacklist', false, $user_id, $title, $content ) ) {
     211    if ( apply_filters_deprecated( 'bp_bypass_check_for_blacklist', array( false, $user_id, $title, $content ), '7.0.0', 'bp_bypass_check_for_disallowed_keys' ) ) {
     212        return true;
     213    }
     214
     215    /**
     216     * Filters whether or not to bypass checking for blocked keys.
     217     *
     218     * @since 7.0.0
     219     *
     220     * @param bool   $value   Whether or not to bypass checking. Default false.
     221     * @param int    $user_id Topic of reply author ID.
     222     * @param string $title   The title of the content.
     223     * @param string $content $the content being posted.
     224     */
     225    if ( apply_filters( 'bp_bypass_check_for_disallowed_keys', false, $user_id, $title, $content ) ) {
    214226        return true;
    215227    }
     
    294306                    return false;
    295307                } else {
    296                     return new WP_Error( 'bp_moderation_blacklist_match', _x( 'You have posted an inappropriate word.', 'Comment blacklist', 'buddypress' ) );
     308                    return new WP_Error( 'bp_moderation_disallowed_key_match', _x( 'You have posted an inappropriate word.', 'Comment disallowed key', 'buddypress' ) );
    297309                }
    298310            }
  • trunk/src/class-buddypress.php

    r12678 r12698  
    511511            require( $this->plugin_dir . 'bp-core/deprecated/4.0.php' );
    512512            require( $this->plugin_dir . 'bp-core/deprecated/6.0.php' );
     513            require( $this->plugin_dir . 'bp-core/deprecated/7.0.php' );
    513514        }
    514515
Note: See TracChangeset for help on using the changeset viewer.