返回介绍

update_blog_status()

发布于 2017-09-11 11:02:45 字数 4282 浏览 1034 评论 0 收藏 0

update_blog_status( int $blog_id,  string $pref,  string $value,  null $deprecated = null )

Update a blog details field.


description


参数

$blog_id

(int) (Required) BLog ID

$pref

(string) (Required) A field name

$value

(string) (Required) Value for $pref

$deprecated

(null) (Optional)

Default value: null


返回值

(string|false) $value


源代码

File: 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.
 		 */
		do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
	}

	return $value;
}

更新日志

Versiondescription
MUIntroduced.

相关函数

Uses

  • wp-includes/functions.php: _deprecated_argument()
  • wp-includes/functions.php: current_time()
  • wp-includes/plugin.php: do_action()
  • wp-includes/ms-blogs.php: update_blog_public
  • wp-includes/ms-blogs.php: refresh_blog_details()
  • wp-includes/ms-blogs.php: make_spam_blog
  • wp-includes/ms-blogs.php: make_ham_blog
  • wp-includes/ms-blogs.php: mature_blog
  • wp-includes/ms-blogs.php: unmature_blog
  • wp-includes/ms-blogs.php: archive_blog
  • wp-includes/ms-blogs.php: unarchive_blog
  • wp-includes/ms-blogs.php: make_delete_blog
  • wp-includes/ms-blogs.php: make_undelete_blog
  • wp-includes/wp-db.php: wpdb::update()
  • Show 9 more uses Hide more uses

Used By

  • wp-admin/includes/ms.php: wpmu_delete_blog()
  • wp-includes/ms-functions.php: update_blog_public()
  • wp-includes/ms-functions.php: wpmu_create_blog()
  • wp-includes/ms-blogs.php: update_archived()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文