6 * @subpackage Multisite
10 require_once( './admin.php' );
12 if ( !is_multisite() )
13 wp_die( __( 'Multisite support is not enabled.' ) );
15 if ( ! current_user_can('read') )
16 wp_die( __( 'You do not have sufficient permissions to view this page.' ) );
18 $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
20 $blogs = get_blogs_of_user( $current_user->id );
22 if ( empty( $blogs ) )
23 wp_die( __( 'You must be a member of at least one site to use this page.' ) );
26 if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
27 check_admin_referer( 'update-my-sites' );
29 $blog = get_blog_details( (int) $_POST['primary_blog'] );
30 if ( $blog && isset( $blog->domain ) ) {
31 update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
34 wp_die( __( 'The primary site you chose does not exist.' ) );
38 $title = __( 'My Sites' );
39 $parent_file = 'index.php';
41 add_contextual_help($current_screen,
42 '<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' .
43 '<p>' . __('Up until WordPress version 3.0, what is now called a Multi-site Network had to be installed separately as WordPress MU (multi-user).') . '</p>' .
44 '<p><strong>' . __('For more information:') . '</strong></p>' .
45 '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_SubPanel" target="_blank">My Sites Documentation</a>') . '</p>' .
46 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
49 require_once( './admin-header.php' );
52 <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
56 <?php screen_icon(); ?>
57 <h2><?php echo esc_html( $title ); ?></h2>
58 <form id="myblogs" action="" method="post">
60 choose_primary_blog();
61 do_action( 'myblogs_allblogs_options' );
64 <table class="widefat fixed">
66 $settings_html = apply_filters( 'myblogs_options', '', 'global' );
67 if ( $settings_html != '' ) {
68 echo '<tr><td valign="top"><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
73 $num = count( $blogs );
79 $num_rows = ceil( $num / $cols );
81 for ( $i = 1; $i <= $num_rows; $i++ ) {
82 $rows[] = array_slice( $blogs, $split, $cols );
83 $split = $split + $cols;
87 foreach ( $rows as $row ) {
88 $c = $c == 'alternate' ? '' : 'alternate';
89 echo "<tr class='$c'>";
91 foreach ( $row as $user_blog ) {
92 $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
93 echo "<td valign='top' style='$s'>";
94 echo "<h3>{$user_blog->blogname}</h3>";
95 echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
96 echo apply_filters( 'myblogs_options', '', $user_blog );
103 <input type="hidden" name="action" value="updateblogsettings" />
104 <?php wp_nonce_field( 'update-my-sites' ); ?>
106 <input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ) ?>" />
111 include( './admin-footer.php' );