Use is_super_admin() instead of is_site_admin(). Props GIGALinux see #11644
git-svn-id: http://svn.automattic.com/wordpress/trunk@12672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e068f48744
commit
dea7019303
|
@ -576,7 +576,7 @@ function mu_options( $options ) {
|
||||||
add_filter( 'whitelist_options', 'mu_options' );
|
add_filter( 'whitelist_options', 'mu_options' );
|
||||||
|
|
||||||
function check_import_new_users( $permission ) {
|
function check_import_new_users( $permission ) {
|
||||||
if ( !is_site_admin() )
|
if ( !is_super_admin() )
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +648,7 @@ remove_action( 'media_buttons', 'media_buttons' );
|
||||||
|
|
||||||
/* Warn the admin if SECRET SALT information is missing from wp-config.php */
|
/* Warn the admin if SECRET SALT information is missing from wp-config.php */
|
||||||
function secret_salt_warning() {
|
function secret_salt_warning() {
|
||||||
if( !is_site_admin() )
|
if( !is_super_admin() )
|
||||||
return;
|
return;
|
||||||
$secret_keys = array( 'NONCE_KEY', 'AUTH_KEY', 'AUTH_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' );
|
$secret_keys = array( 'NONCE_KEY', 'AUTH_KEY', 'AUTH_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' );
|
||||||
$out = '';
|
$out = '';
|
||||||
|
@ -714,7 +714,7 @@ function admin_notice_feed() {
|
||||||
$link = clean_url( strip_tags( $item['link'] ) );
|
$link = clean_url( strip_tags( $item['link'] ) );
|
||||||
$msg .= "<p>" . $content . " <a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $item[ 'title' ] ) . "'>" . __( "Dismiss" ) . "</a></p>";
|
$msg .= "<p>" . $content . " <a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $item[ 'title' ] ) . "'>" . __( "Dismiss" ) . "</a></p>";
|
||||||
echo "<div class='updated fade'>$msg</div>";
|
echo "<div class='updated fade'>$msg</div>";
|
||||||
} elseif( is_site_admin() ) {
|
} elseif( is_super_admin() ) {
|
||||||
printf("<div id='update-nag'>" . __("Your feed at %s is empty.") . "</div>", wp_specialchars( $url ));
|
printf("<div id='update-nag'>" . __("Your feed at %s is empty.") . "</div>", wp_specialchars( $url ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -722,7 +722,7 @@ add_action( 'admin_notices', 'admin_notice_feed' );
|
||||||
|
|
||||||
function site_admin_notice() {
|
function site_admin_notice() {
|
||||||
global $current_user, $wp_db_version;
|
global $current_user, $wp_db_version;
|
||||||
if( !is_site_admin() )
|
if( !is_super_admin() )
|
||||||
return false;
|
return false;
|
||||||
printf("<div id='update-nag'>" . __("Hi %s! You're logged in as a site administrator.") . "</div>", $current_user->user_login);
|
printf("<div id='update-nag'>" . __("Hi %s! You're logged in as a site administrator.") . "</div>", $current_user->user_login);
|
||||||
if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
|
if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
|
||||||
|
@ -812,7 +812,7 @@ add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' );
|
||||||
* Adds the "Activate plugin site wide" row for each plugin in the inactive plugins list.
|
* Adds the "Activate plugin site wide" row for each plugin in the inactive plugins list.
|
||||||
*/
|
*/
|
||||||
function add_sitewide_activate_row( $file, $plugin_data, $context ) {
|
function add_sitewide_activate_row( $file, $plugin_data, $context ) {
|
||||||
if ( !is_site_admin() )
|
if ( !is_super_admin() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( 'sitewide-active' == $context )
|
if ( 'sitewide-active' == $context )
|
||||||
|
@ -859,7 +859,7 @@ function is_wpmu_sitewide_plugin( $file ) {
|
||||||
function list_activate_sitewide_plugins() {
|
function list_activate_sitewide_plugins() {
|
||||||
$all_plugins = get_plugins();
|
$all_plugins = get_plugins();
|
||||||
|
|
||||||
if ( !is_site_admin() )
|
if ( !is_super_admin() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins') );
|
$active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins') );
|
||||||
|
@ -963,7 +963,7 @@ function sitewide_filter_inactive_plugins_list( $inactive_plugins ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now unset any sitewide only plugins if the user is not a site admin */
|
/* Now unset any sitewide only plugins if the user is not a site admin */
|
||||||
if ( !is_site_admin() ) {
|
if ( !is_super_admin() ) {
|
||||||
foreach ( $inactive_plugins as $plugin_name => $activated_time ) {
|
foreach ( $inactive_plugins as $plugin_name => $activated_time ) {
|
||||||
if ( is_wpmu_sitewide_plugin( $plugin_name ) )
|
if ( is_wpmu_sitewide_plugin( $plugin_name ) )
|
||||||
unset( $inactive_plugins[ $plugin_name ] );
|
unset( $inactive_plugins[ $plugin_name ] );
|
||||||
|
@ -1006,7 +1006,7 @@ function check_is_wpmu_plugin_on_activate() {
|
||||||
deactivate_plugins( $_GET['plugin'], true );
|
deactivate_plugins( $_GET['plugin'], true );
|
||||||
|
|
||||||
/* Silently activate because the activate_* hook has already run. */
|
/* Silently activate because the activate_* hook has already run. */
|
||||||
if ( is_site_admin() ) {
|
if ( is_super_admin() ) {
|
||||||
$_GET['sitewide'] = true;
|
$_GET['sitewide'] = true;
|
||||||
activate_sitewide_plugin( $_GET['plugin'], true );
|
activate_sitewide_plugin( $_GET['plugin'], true );
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,7 @@ function check_wpmu_plugins_on_bulk_activate( $plugins ) {
|
||||||
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
|
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
|
||||||
deactivate_plugins( $plugin );
|
deactivate_plugins( $plugin );
|
||||||
|
|
||||||
if ( is_site_admin() )
|
if ( is_super_admin() )
|
||||||
activate_sitewide_plugin( $plugin );
|
activate_sitewide_plugin( $plugin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1090,7 @@ function disable_some_pages() {
|
||||||
global $messages;
|
global $messages;
|
||||||
|
|
||||||
if ( strpos( $_SERVER['PHP_SELF'], 'user-new.php' ) && !get_site_option( 'add_new_users' ) ) {
|
if ( strpos( $_SERVER['PHP_SELF'], 'user-new.php' ) && !get_site_option( 'add_new_users' ) ) {
|
||||||
if ( is_site_admin() ) {
|
if ( is_super_admin() ) {
|
||||||
$messages[] = '<div id="message" class="updated fade"><p>' . __( 'Warning! Only site administrators may see this page. Everyone else will see a <em>page disabled</em> message. Enable it again on <a href="ms-options.php#addnewusers">the options page</a>.' ) . '</p></div>';
|
$messages[] = '<div id="message" class="updated fade"><p>' . __( 'Warning! Only site administrators may see this page. Everyone else will see a <em>page disabled</em> message. Enable it again on <a href="ms-options.php#addnewusers">the options page</a>.' ) . '</p></div>';
|
||||||
} else {
|
} else {
|
||||||
wp_die( __('Page disabled by the administrator') );
|
wp_die( __('Page disabled by the administrator') );
|
||||||
|
@ -1106,7 +1106,7 @@ function disable_some_pages() {
|
||||||
|
|
||||||
$pages = array( 'theme-install.php', 'plugin-install.php' );
|
$pages = array( 'theme-install.php', 'plugin-install.php' );
|
||||||
foreach( $pages as $page ) {
|
foreach( $pages as $page ) {
|
||||||
if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_site_admin() ) {
|
if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_super_admin() ) {
|
||||||
wp_die( __( "Sorry, you're not allowed here." ) );
|
wp_die( __( "Sorry, you're not allowed here." ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1247,7 +1247,7 @@ function stripslashes_from_options( $blog_id ) {
|
||||||
add_action( 'wpmu_upgrade_site', 'stripslashes_from_options' );
|
add_action( 'wpmu_upgrade_site', 'stripslashes_from_options' );
|
||||||
|
|
||||||
function show_post_thumbnail_warning() {
|
function show_post_thumbnail_warning() {
|
||||||
if ( false == is_site_admin() ) {
|
if ( false == is_super_admin() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
|
$mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
|
||||||
|
|
|
@ -1025,7 +1025,7 @@ function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
|
||||||
if( in_array( $blogname, $illegal_names ) == true ) {
|
if( in_array( $blogname, $illegal_names ) == true ) {
|
||||||
$errors->add('blogname', __("That name is not allowed"));
|
$errors->add('blogname', __("That name is not allowed"));
|
||||||
}
|
}
|
||||||
if( strlen( $blogname ) < 4 && !is_site_admin() ) {
|
if( strlen( $blogname ) < 4 && !is_super_admin() ) {
|
||||||
$errors->add('blogname', __("Blog name must be at least 4 characters"));
|
$errors->add('blogname', __("Blog name must be at least 4 characters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,7 +1305,7 @@ function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id
|
||||||
|
|
||||||
update_option( 'blog_public', $meta['public'] );
|
update_option( 'blog_public', $meta['public'] );
|
||||||
|
|
||||||
if ( !is_site_admin() && get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
|
if ( !is_super_admin() && get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
|
||||||
update_usermeta( $user_id, 'primary_blog', $blog_id );
|
update_usermeta( $user_id, 'primary_blog', $blog_id );
|
||||||
|
|
||||||
restore_current_blog();
|
restore_current_blog();
|
||||||
|
@ -1522,7 +1522,7 @@ function install_blog_defaults($blog_id, $user_id) {
|
||||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
|
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
|
||||||
|
|
||||||
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
|
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
|
||||||
if ( !is_site_admin( $user->user_login ) && $user_id != 1 )
|
if ( !is_super_admin( $user->user_login ) && $user_id != 1 )
|
||||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );
|
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );
|
||||||
|
|
||||||
$wpdb->suppress_errors( false );
|
$wpdb->suppress_errors( false );
|
||||||
|
@ -1927,7 +1927,7 @@ function upload_is_file_too_big( $upload ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wordpressmu_authenticate_siteadmin( $user, $password = '' ) {
|
function wordpressmu_authenticate_siteadmin( $user, $password = '' ) {
|
||||||
if( is_site_admin( $user->user_login ) == false && ( $primary_blog = get_usermeta( $user->user_id, "primary_blog" ) ) ) {
|
if( is_super_admin( $user->user_login ) == false && ( $primary_blog = get_usermeta( $user->user_id, "primary_blog" ) ) ) {
|
||||||
$details = get_blog_details( $primary_blog );
|
$details = get_blog_details( $primary_blog );
|
||||||
if( is_object( $details ) && $details->spam == 1 ) {
|
if( is_object( $details ) && $details->spam == 1 ) {
|
||||||
return new WP_Error('blog_suspended', __('Blog Suspended.'));
|
return new WP_Error('blog_suspended', __('Blog Suspended.'));
|
||||||
|
|
|
@ -374,7 +374,7 @@ if( !$active_signup )
|
||||||
|
|
||||||
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
|
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
|
||||||
|
|
||||||
if( is_site_admin() )
|
if( is_super_admin() )
|
||||||
echo '<div class="mu_alert">' . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/ms-options.php'>Options page</a>." ), $active_signup ) . '</div>';
|
echo '<div class="mu_alert">' . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/ms-options.php'>Options page</a>." ), $active_signup ) . '</div>';
|
||||||
|
|
||||||
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
|
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
|
||||||
|
|
|
@ -443,7 +443,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*/
|
*/
|
||||||
function wp_getUsersBlogs( $args ) {
|
function wp_getUsersBlogs( $args ) {
|
||||||
// If this isn't on WPMU then just use blogger_getUsersBlogs
|
// If this isn't on WPMU then just use blogger_getUsersBlogs
|
||||||
if( !function_exists( 'is_site_admin' ) ) {
|
if( !is_multisite() ) {
|
||||||
array_unshift( $args, 1 );
|
array_unshift( $args, 1 );
|
||||||
return $this->blogger_getUsersBlogs( $args );
|
return $this->blogger_getUsersBlogs( $args );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue