bp_core_action_set_spammer_status( int $user_id )

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


Description 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 Parameters

$user_id

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


Top ↑

Source Source

File: bp-core/deprecated/3.0.php

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.', 'buddypress' ) );
		} else {
			bp_core_add_message( __( 'User removed as spammer.', 'buddypress' ) );
		}

		// 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() );
	}
}

Top ↑

Changelog Changelog

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

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.