wp_cache_add_non_persistent_groups

Definition:
function wp_cache_add_non_persistent_groups( $groups ) {}

Adds a group or set of groups to the list of non-persistent groups.

Parameters

  • string|array $groups: A group or an array of groups to add

Source code

function wp_cache_add_non_persistent_groups( $groups ) {

	// Default cache doesn't persist so nothing to do here.

	return;

}

3439

wp_cache_add_global_groups

Definition:
function wp_cache_add_global_groups( $groups ) {}

Adds a group or set of groups to the list of global groups.

Parameters

  • string|array $groups: A group or an array of groups to add

Source code

function wp_cache_add_global_groups( $groups ) {

	global $wp_object_cache;



	return $wp_object_cache->add_global_groups($groups);

}

3437

wp_cache_add

Definition:
function wp_cache_add($key, $data, $group = '', $expire = 0) {}

Adds data to the cache, if the cache key doesn’t already exist.

Parameters

  • int|string $key: The cache key to use for retrieval later
  • mixed $data: The data to add to the cache store
  • string $group: The group to add the cache to
  • int $expire: When the cache data should be expired

Source code

function wp_cache_add($key, $data, $group = '', $expire = 0) {

	global $wp_object_cache;



	return $wp_object_cache->add($key, $data, $group, $expire);

}

3435

wp_blacklist_check

Definition:
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {}

Does comment contain blacklisted characters or words.

Parameters

  • string $author: The author of the comment
  • string $email: The email of the comment
  • string $url: The url used in the comment
  • string $comment: The comment content
  • string $user_ip: The comment author IP address
  • string $user_agent: The author’s browser user agent

Return values

returns:True if comment contains blacklisted content, false if comment does not

Defined actions

  • wp_blacklist_check
    do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);

Source code

function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {

	do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);



	$mod_keys = trim( get_option('blacklist_keys') );

	if ( '' == $mod_keys )

		return false; // If moderation keys are empty

	$words = explode("\n", $mod_keys );



	foreach ( (array) $words as $word ) {

		$word = trim($word);



		// Skip empty lines

		if ( empty($word) ) { continue; }



		// Do some escaping magic so that '#' chars in the

		// spam words don't break things:

		$word = preg_quote($word, '#');



		$pattern = "#$word#i";

		if (

			   preg_match($pattern, $author)

			|| preg_match($pattern, $email)

			|| preg_match($pattern, $url)

			|| preg_match($pattern, $comment)

			|| preg_match($pattern, $user_ip)

			|| preg_match($pattern, $user_agent)

		 )

			return true;

	}

	return false;

}

3433

wp_authenticate_username_password

Definition:
function wp_authenticate_username_password($user, $username, $password) {}

Authenticate the user using the username and password.

Parameters

  • $user
  • $username
  • $password

Defined filters

  • wp_authenticate_user
    apply_filters('wp_authenticate_user', $userdata, $password)

Source code

function wp_authenticate_username_password($user, $username, $password) {

	if ( is_a($user, 'WP_User') ) { return $user; }



	if ( empty($username) || empty($password) ) {

		$error = new WP_Error();



		if ( empty($username) )

			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));



		if ( empty($password) )

			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));



		return $error;

	}



	$userdata = get_user_by('login', $username);



	if ( !$userdata )

		return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), wp_lostpassword_url()));



	if ( is_multisite() ) {

		// Is user marked as spam?

		if ( 1 == $userdata->spam)

			return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Your account has been marked as a spammer.'));



		// Is a user's blog marked as spam?

		if ( !is_super_admin( $userdata->ID ) && isset($userdata->primary_blog) ) {

			$details = get_blog_details( $userdata->primary_blog );

			if ( is_object( $details ) && $details->spam == 1 )

				return new WP_Error('blog_suspended', __('Site Suspended.'));

		}

	}



	$userdata = apply_filters('wp_authenticate_user', $userdata, $password);

	if ( is_wp_error($userdata) )

		return $userdata;



	if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )

		return new WP_Error( 'incorrect_password', sprintf( __( '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?' ),

		$username, wp_lostpassword_url() ) );



	$user =  new WP_User($userdata->ID);

	return $user;

}

3431