bp_core_action_set_spammer_status( int $user_id )

Catch a “Mark as Spammer/Not Spammer” click from the toolbar.

Description

When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu this action will fire and mark or unmark the user and their blogs as spam. Must be a site admin for this function to run.

Note: no longer used in the current state. See the Settings component.

Parameters

$user_id

(Optional) User ID to mark as spam. Defaults to displayed user.

Source

File: bp-core/deprecated/buddypress/3.0.php

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
function bp_core_action_set_spammer_status( $user_id = 0 ) {
    _deprecated_function( __FUNCTION__, '3.0' );
 
    // Only super admins can currently spam users (but they can't spam
    // themselves).
    if ( ! is_super_admin() || bp_is_my_profile() ) {
        return;
    }
 
    // Use displayed user if it's not yourself.
    if ( empty( $user_id ) )
        $user_id = bp_displayed_user_id();
 
    if ( bp_is_current_component( 'admin' ) && ( in_array( bp_current_action(), array( 'mark-spammer', 'unmark-spammer' ) ) ) ) {
 
        // Check the nonce.
        check_admin_referer( 'mark-unmark-spammer' );
 
        // To spam or not to spam.
        $status = bp_is_current_action( 'mark-spammer' ) ? 'spam' : 'ham';
 
        // The heavy lifting.
        bp_core_process_spammer_status( $user_id, $status );
 
        // Add feedback message. @todo - Error reporting.
        if ( 'spam' == $status ) {
            bp_core_add_message( __( 'User marked as spammer. Spam users are visible only to site admins.', 'buddyboss' ) );
        } else {
            bp_core_add_message( __( 'User removed as spammer.', 'buddyboss' ) );
        }
 
        // Deprecated. Use bp_core_process_spammer_status.
        $is_spam = 'spam' == $status;
        do_action( 'bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam );
 
        // Redirect back to where we came from.
        bp_core_redirect( wp_get_referer() );
    }
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Formally marked as deprecated. BuddyPress 3.0.0 Formally marked as deprecated.
BuddyPress 1.6.0 No longer used, unhooked. BuddyPress 1.6.0 No longer used, unhooked.
BuddyPress 1.1.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.