update_blog_status
Update a blog details field.
Description
(string|false) update_blog_status( (int) $blog_id, (string) $pref, (string) $value, (null) $deprecated = null );
Returns (string|false)
$value
Parameters (4)
- 0. $blog_id (int)
- The blog id.
- 1. $pref (string)
- A field name
- 2. $value (string)
- Value for
$pref
- 3. $deprecated — Optional. (null) =>
null
- The deprecated.
Usage
if ( !function_exists( 'update_blog_status' ) ) { require_once ABSPATH . WPINC . '/ms-blogs.php'; } // The blog id. $blog_id = -1; // A field name $pref = ''; // Value for $pref $value = ''; // The deprecated. $deprecated = null; // NOTICE! Understand what this does before running. $result = update_blog_status($blog_id, $pref, $value, $deprecated);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/ms-blogs.php
- function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
- global $wpdb;
- if ( null !== $deprecated )
- _deprecated_argument( __FUNCTION__, '3.1.0' );
- if ( ! in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) )
- return $value;
- $result = $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
- if ( false === $result )
- return false;
- refresh_blog_details( $blog_id );
- if ( 'spam' == $pref ) {
- if ( $value == 1 ) {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'make_spam_blog', $blog_id );
- } else {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'make_ham_blog', $blog_id );
- }
- } elseif ( 'mature' == $pref ) {
- if ( $value == 1 ) {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'mature_blog', $blog_id );
- } else {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'unmature_blog', $blog_id );
- }
- } elseif ( 'archived' == $pref ) {
- if ( $value == 1 ) {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'archive_blog', $blog_id );
- } else {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'unarchive_blog', $blog_id );
- }
- } elseif ( 'deleted' == $pref ) {
- if ( $value == 1 ) {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'make_delete_blog', $blog_id );
- } else {
- /** This filter is documented in wp-includes/ms-blogs.php */
- do_action( 'make_undelete_blog', $blog_id );
- }
- } elseif ( 'public' == $pref ) {
- /**
- * Fires after the current blog's 'public' setting is updated.
- *
- * @since MU
- *
- * @param int $blog_id Blog ID.
- * @param string $value The value of blog status.
- */
- }
- return $value;
- }