wp_maybe_transition_site_statuses_on_update() – Triggers actions on site status updates.

You appear to be a bot. Output may be restricted

Description

Triggers actions on site status updates.

Usage

wp_maybe_transition_site_statuses_on_update( $new_site, $old_site );

Parameters

$new_site
( WP_Site ) required – The site object after the update.
$old_site
( WP_Site|null ) optional – Optional. If $new_site has been updated, this must be the previous state of that site. Default null.

Returns

void

Source

File name: wordpress/wp-includes/ms-site.php
Lines:

1 to 100 of 117
function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null ) {
  $site_id = $new_site->id;

  // Use the default values for a site if no previous state is given.
  if ( ! $old_site ) {
    $old_site = new WP_Site( new stdClass() );
  }

  if ( $new_site->spam != $old_site->spam ) {
    if ( 1 == $new_site->spam ) {

      
/**
 * Fires when the 'spam' status is added to a site.
 *
 * @since MU (3.0.0)
 *
 * @param int $site_id Site ID.
 */
      do_action( 'make_spam_blog', $site_id );
    } else {

      
/**
 * Fires when the 'spam' status is removed from a site.
 *
 * @since MU (3.0.0)
 *
 * @param int $site_id Site ID.
 */
      do_action( 'make_ham_blog', $site_id );
    }
  }

  if ( $new_site->mature != $old_site->mature ) {
    if ( 1 == $new_site->mature ) {

      
/**
 * Fires when the 'mature' status is added to a site.
 *
 * @since 3.1.0
 *
 * @param int $site_id Site ID.
 */
      do_action( 'mature_blog', $site_id );
    } else {

      
/**
 * Fires when the 'mature' status is removed from a site.
 *
 * @since 3.1.0
 *
 * @param int $site_id Site ID.
 */
      do_action( 'unmature_blog', $site_id );
    }
  }

  if ( $new_site->archived != $old_site->archived ) {
    if ( 1 == $new_site->archived ) {

      
/**
 * Fires when the 'archived' status is added to a site.
 *
 * @since MU (3.0.0)
 *
 * @param int $site_id Site ID.
 */
      do_action( 'archive_blog', $site_id );
    } else {

      
/**
 * Fires when the 'archived' status is removed from a site.
 *
 * @since MU (3.0.0)
 *
 * @param int $site_id Site ID.
 */
      do_action( 'unarchive_blog', $site_id );
    }
  }

  if ( $new_site->deleted != $old_site->deleted ) {
    if ( 1 == $new_site->deleted ) {

      
/**
 * Fires when the 'deleted' status is added to a site.
 *
 * @since 3.5.0
 *
 * @param int $site_id Site ID.
 */
      do_action( 'make_delete_blog', $site_id );
    } else {

      
/**
 * Fires when the 'deleted' status is removed from a site.
 *
 * @since 3.5.0
 *
 * @param int $site_id Site ID.
 */
 

 View on GitHub View on Trac