Allow flagging of a blog as mature via a URL. Move some actions into update_blog_status(). Props Viper007Bond. fixes #14385

git-svn-id: http://svn.automattic.com/wordpress/trunk@15836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-10-18 18:53:47 +00:00
parent bb6b103711
commit 72a9626c15
2 changed files with 28 additions and 8 deletions

View File

@ -398,7 +398,6 @@ switch ( $_GET['action'] ) {
wp_die( __( 'You do not have permission to access this page.' ) );
update_blog_status( $id, 'archived', '1' );
do_action( 'archive_blog', $id );
wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
exit();
break;
@ -408,7 +407,6 @@ switch ( $_GET['action'] ) {
if ( ! current_user_can( 'manage_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
do_action( 'unarchive_blog', $id );
update_blog_status( $id, 'archived', '0' );
wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
exit();
@ -456,6 +454,26 @@ switch ( $_GET['action'] ) {
exit();
break;
case 'unmatureblog':
check_admin_referer( 'unmatureblog' );
if ( ! current_user_can( 'manage_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
update_blog_status( $id, 'mature', '0' );
wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
exit();
break;
case 'matureblog':
check_admin_referer( 'matureblog' );
if ( ! current_user_can( 'manage_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
update_blog_status( $id, 'mature', '1' );
wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
exit();
break;
// Themes
case 'updatethemes':
if ( ! current_user_can( 'manage_network_themes' ) )

View File

@ -628,12 +628,14 @@ function update_blog_status( $blog_id, $pref, $value, $refresh = true ) {
if ( $refresh )
refresh_blog_details($blog_id);
if ( $pref == 'spam' ) {
if ( $value == 1 )
do_action( "make_spam_blog", $blog_id );
else
do_action( "make_ham_blog", $blog_id );
}
if ( 'spam' == $pref )
( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id );
elseif ( 'mature' == $pref )
( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id );
elseif ( 'archived' == $pref )
( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
elseif ( 'archived' == $pref )
( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
return $value;
}