Ejemplo n.º 1
0
function _ga_initialize_admin_bar_changes()
{
    if (!is_multinetwork()) {
        return;
    }
    add_action('admin_bar_menu', '_ga_adjust_admin_bar_my_sites_menu', 19, 1);
    if (!is_global_admin()) {
        return;
    }
    remove_action('admin_bar_menu', 'wp_admin_bar_site_menu', 30);
    remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    remove_action('admin_bar_menu', 'wp_admin_bar_new_content_menu', 70);
    add_action('admin_bar_menu', '_ga_adjust_admin_bar_site_menu', 30, 1);
}
Ejemplo n.º 2
0
if (!current_user_can('manage_network_options')) {
    wp_die(__('Sorry, you are not allowed to manage options for this network.', 'global-admin'));
}
if (is_multinetwork() && !is_global_admin()) {
    wp_redirect(global_admin_url('setup.php'));
    exit;
}
require_once GA_PATH . 'global-admin/wp-admin/includes/global.php';
// This would be it if it was part of Core.
//require_once( ABSPATH . 'wp-admin/includes/global.php' );
// We need to create references to ms global tables to enable Network.
ga_register_table();
if (!global_table_check() && (!defined('WP_ALLOW_MULTINETWORK') || !WP_ALLOW_MULTINETWORK)) {
    wp_die(printf(__('You must define the %1$s constant as true in your %2$s file to allow creation of a Multinetwork.', 'global-admin'), '<code>WP_ALLOW_MULTINETWORK</code>', '<code>wp-config.php</code>'));
}
if (is_global_admin()) {
    $title = __('Global Setup', 'global-admin');
} else {
    $title = __('Create a Multinetwork', 'global-admin');
}
$parent_file = 'settings.php';
$global_help = '<p>' . __('This screen allows you to configure a multinetwork setup which will provide you with a Global Admin panel to add further networks.', 'global-admin') . '</p>' . '<p>' . __('The next screen for Global Setup will give you individually-generated lines of code to add to your wp-config.php file. Make a backup copy of that file.', 'global-admin') . '</p>' . '<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>).', 'global-admin') . '</p>' . '<p>' . __('Once you add this code and refresh your browser, multinetwork should be enabled. This screen, now in the Global Admin navigation menu, will keep an archive of the added code. You can toggle between Global Admin and Network Admin by clicking on the Global Admin or an individual network name under the My Networks dropdown in the Toolbar.', 'global-admin') . '</p>' . '<p><strong>' . __('For more information:', 'global-admin') . '</strong></p>' . '<p>' . __('<a href="https://github.com/felixarntz/global-admin/wiki/Create-A-Multinetwork" target="_blank">Documentation on Creating a Multinetwork</a>', 'global-admin') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'global', 'title' => __('Multinetwork', 'global-admin'), 'content' => $global_help));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'global-admin') . '</strong></p>' . '<p>' . __('<a href="https://github.com/felixarntz/global-admin/wiki/Create-A-Multinetwork" target="_blank">Documentation on Creating a Multinetwork</a>', 'global-admin') . '</p>');
// Only load admin header and footer files when loaded directly. Otherwise they are included by WP Core.
$_ga_load_admin_files = !did_action('in_admin_header');
if ($_ga_load_admin_files) {
    include ABSPATH . 'wp-admin/admin-header.php';
}
?>
<div class="wrap">
Ejemplo n.º 3
0
/**
 * Adjusts the edit user link to consider the Global Administration panel as well.
 *
 * @since 1.0.0
 * @access private
 *
 * @param string $link    The edit user link.
 * @param int    $user_id The user ID.
 * @return string The adjusted link.
 */
function _ga_adjust_edit_user_link($link, $user_id)
{
    if (get_current_user_id() == $user_id || !is_global_admin()) {
        return $link;
    }
    return add_query_arg('user_id', $user_id, global_admin_url('user-edit.php'));
}
Ejemplo n.º 4
0
/**
 * Adjusts the title for the title tag in the global administration panel.
 *
 * If it was in Core, it would happen directly in `wp-admin/admin-header.php`.
 *
 * @since 1.0.0
 * @access private
 *
 * @param string $admin_title Original admin title.
 * @param string $title       Original title.
 * @return string Modified admin title if in global administration panel.
 */
function _ga_adjust_admin_title($admin_title, $title)
{
    if (!is_global_admin()) {
        return $admin_title;
    }
    $new_admin_title = __('Global Admin', 'global-admin');
    if (false === strpos($admin_title, '&lsaquo;')) {
        $admin_title = sprintf(__('%1$s &#8212; WordPress'), $new_admin_title);
    } else {
        $admin_title = sprintf(__('%1$s &lsaquo; %2$s &#8212; WordPress'), $title, $new_admin_title);
    }
    return $admin_title;
}