update_blog_public

Definition:
function update_blog_public( $old_value, $value ) {}

Update this blog’s ‘public’ setting in the global blogs table.
Public blogs have a setting of 1, private blogs are 0.

Parameters

  • int $old_value
  • int $value: The new public value

Defined actions

  • update_blog_public
    do_action('update_blog_public');

Source code

function update_blog_public( $old_value, $value ) {

	global $wpdb;

	do_action('update_blog_public');

	update_blog_status( $wpdb->blogid, 'public', (int) $value );

}

3159

update_blog_option

Definition:
function update_blog_option( $id, $key, $value, $deprecated = null ) {}

Update an option for a particular blog.

Parameters

  • int $id: The blog id
  • string $key: The option key
  • mixed $value: The option value
  • $deprecated

Return values

returns:True on success, false on failrue.

Source code

function update_blog_option( $id, $key, $value, $deprecated = null ) {

	$id = (int) $id;



	if ( null !== $deprecated  )

		_deprecated_argument( __FUNCTION__, '3.1' );



	switch_to_blog($id);

	$return = update_option( $key, $value );

	restore_current_blog();



	refresh_blog_details( $id );



	if ( $return )

		wp_cache_set( $id . '-' . $key . '-blog_option', $value, 'site-options');

	return $return;

}

3157

update_blog_details

Definition:
function update_blog_details( $blog_id, $details = array() {}

Update the details for a blog. Updates the blogs table for a given blog id.

Parameters

  • int $blog_id: Blog ID
  • array $details: Array of details keyed by blogs table field names.

Return values

returns:True if update succeeds, false otherwise.

Defined actions

  • make_spam_blog
    do_action( "make_spam_blog", $blog_id );
  • make_ham_blog
    do_action( "make_ham_blog", $blog_id );

Source code

function update_blog_details( $blog_id, $details = array() ) {

	global $wpdb;



	if ( empty($details) )

		return false;



	if ( is_object($details) )

		$details = get_object_vars($details);



	$current_details = get_blog_details($blog_id, false);

	if ( empty($current_details) )

		return false;



	$current_details = get_object_vars($current_details);



	$details = array_merge($current_details, $details);

	$details['last_updated'] = current_time('mysql', true);



	$update_details = array();

	$fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');

	foreach ( array_intersect( array_keys( $details ), $fields ) as $field )

		$update_details[$field] = $details[$field];



	$wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );



	// If spam status changed, issue actions.

	if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) {

		if ( $details[ 'spam' ] == 1 )

			do_action( "make_spam_blog", $blog_id );

		else

			do_action( "make_ham_blog", $blog_id );

	}



	if ( isset($details[ 'public' ]) )

		update_blog_option( $blog_id, 'blog_public', $details[ 'public' ] );



	refresh_blog_details($blog_id);



	return true;

}

3155

update_attached_file

Definition:
function update_attached_file( $attachment_id, $file ) {}

Update attachment file path based on attachment ID.
Used to update the file path of the attachment, which uses post meta name ‘_wp_attached_file’ to store the path of the attachment.

Parameters

  • int $attachment_id: Attachment ID
  • string $file: File path for the attachment

Return values

returns:False on failure, true on success.

Defined filters

  • update_attached_file
    apply_filters( 'update_attached_file', $file, $attachment_id )

Source code

function update_attached_file( $attachment_id, $file ) {

	if ( !get_post( $attachment_id ) )

		return false;



	$file = apply_filters( 'update_attached_file', $file, $attachment_id );

	$file = _wp_relative_upload_path($file);



	return update_post_meta( $attachment_id, '_wp_attached_file', $file );

}

3153

update_archived

Definition:
function update_archived( $id, $archived ) {}

Update the ‘archived’ status of a particular blog.

Parameters

  • int $id: The blog id
  • string $archived: The new status

Source code

function update_archived( $id, $archived ) {

	update_blog_status($id, 'archived', $archived);

	return $archived;

}

3151