bp_core_update_member_status( int $user_id, int $value )

Update the spam status of the member on multisite configs.


Parameters Parameters

$user_id

(int) (Required) The user ID to spam or ham.

$value

(int) (Required) 0 to mark the user as ham, 1 to mark as spam.


Top ↑

Return Return

(bool) True if the spam status of the member changed. False otherwise.


Source Source

File: bp-members/bp-members-functions.php

function bp_core_update_member_status( $user_id = 0, $value = 0 ) {
	if ( ! is_multisite() || ! $user_id ) {
		return false;
	}

	/**
	 * The `update_user_status()` function is deprecated since WordPress 5.3.0.
	 * Continue to use it if WordPress current major version is lower than 5.3.
	 */
	if ( bp_get_major_wp_version() < 5.3 ) {
		return update_user_status( $user_id, 'spam', $value );
	}

	// Otherwise use the replacement function.
	$user = wp_update_user( array(
		'ID'   => $user_id,
		'spam' => $value,
	) );

	if ( is_wp_error( $user ) ) {
		return false;
	}

	return true;
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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