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

  1. if ( !function_exists( 'update_blog_status' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = -1; 
  6.  
  7. // A field name 
  8. $pref = ''; 
  9.  
  10. // Value for $pref 
  11. $value = ''; 
  12.  
  13. // The deprecated. 
  14. $deprecated = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = update_blog_status($blog_id, $pref, $value, $deprecated); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-blogs.php  
  1. function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { 
  2. global $wpdb; 
  3.  
  4. if ( null !== $deprecated ) 
  5. _deprecated_argument( __FUNCTION__, '3.1.0' ); 
  6.  
  7. if ( ! in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) ) 
  8. return $value; 
  9.  
  10. $result = $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) ); 
  11.  
  12. if ( false === $result ) 
  13. return false; 
  14.  
  15. refresh_blog_details( $blog_id ); 
  16.  
  17. if ( 'spam' == $pref ) { 
  18. if ( $value == 1 ) { 
  19. /** This filter is documented in wp-includes/ms-blogs.php */ 
  20. do_action( 'make_spam_blog', $blog_id ); 
  21. } else { 
  22. /** This filter is documented in wp-includes/ms-blogs.php */ 
  23. do_action( 'make_ham_blog', $blog_id ); 
  24. } elseif ( 'mature' == $pref ) { 
  25. if ( $value == 1 ) { 
  26. /** This filter is documented in wp-includes/ms-blogs.php */ 
  27. do_action( 'mature_blog', $blog_id ); 
  28. } else { 
  29. /** This filter is documented in wp-includes/ms-blogs.php */ 
  30. do_action( 'unmature_blog', $blog_id ); 
  31. } elseif ( 'archived' == $pref ) { 
  32. if ( $value == 1 ) { 
  33. /** This filter is documented in wp-includes/ms-blogs.php */ 
  34. do_action( 'archive_blog', $blog_id ); 
  35. } else { 
  36. /** This filter is documented in wp-includes/ms-blogs.php */ 
  37. do_action( 'unarchive_blog', $blog_id ); 
  38. } elseif ( 'deleted' == $pref ) { 
  39. if ( $value == 1 ) { 
  40. /** This filter is documented in wp-includes/ms-blogs.php */ 
  41. do_action( 'make_delete_blog', $blog_id ); 
  42. } else { 
  43. /** This filter is documented in wp-includes/ms-blogs.php */ 
  44. } elseif ( 'public' == $pref ) { 
  45. /** 
  46. * Fires after the current blog's 'public' setting is updated. 
  47. * @since MU 
  48. * @param int $blog_id Blog ID. 
  49. * @param string $value The value of blog status. 
  50. */ 
  51. do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public(). 
  52.  
  53. return $value;