update_blog_status

Definition:
function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {}

Update a blog details field.

Parameters

  • int $blog_id: BLog ID
  • string $pref: A field name
  • string $value: Value for $pref
  • $deprecated

Defined actions

  • make_spam_blog
    do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id );
  • mature_blog
    do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id );
  • archive_blog
    do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
  • archive_blog
    do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );

Source code

function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {

	global $wpdb;



	if ( null !== $deprecated  )

		_deprecated_argument( __FUNCTION__, '3.1' );



	if ( !in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) )

		return $value;



	$wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );



	refresh_blog_details($blog_id);



	if ( 'spam' == $pref )

		( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) :	do_action( 'make_ham_blog', $blog_id );

	elseif ( 'mature' == $pref )

		( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id );

	elseif ( 'archived' == $pref )

		( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );

	elseif ( 'archived' == $pref )

		( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );



	return $value;

}

3161

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: