Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 121 lines (106 sloc) 3.805 kB
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
1 <?php
c449adb File-level phpdoc for multisite files.
nacin authored
2 /**
3 * My Sites dashboard.
4 *
5 * @package WordPress
6 * @subpackage Multisite
7 * @since 3.0.0
8 */
9
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
10 require_once( './admin.php' );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
11
12 if ( !is_multisite() )
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
13 wp_die( __( 'Multisite support is not enabled.' ) );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
14
15 if ( ! current_user_can('read') )
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
16 wp_die( __( 'You do not have sufficient permissions to view this page.' ) );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
17
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
18 $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
19
6c81d02 Add magic get/set/isset methods to WP_User to avoid data duplication.…
ryan authored
20 $blogs = get_blogs_of_user( $current_user->ID );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
21
22 $updated = false;
23 if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
24 check_admin_referer( 'update-my-sites' );
25
26 $blog = get_blog_details( (int) $_POST['primary_blog'] );
27 if ( $blog && isset( $blog->domain ) ) {
6c81d02 Add magic get/set/isset methods to WP_User to avoid data duplication.…
ryan authored
28 update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true );
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
29 $updated = true;
30 } else {
7b7243d Strip trailing whites.
ryan authored
31 wp_die( __( 'The primary site you chose does not exist.' ) );
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
32 }
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
33 }
34
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
35 $title = __( 'My Sites' );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
36 $parent_file = 'index.php';
8caed1c Help for multisite. props andrea_r, dougwrites, duck_. see #13467.
nacin authored
37
8ace5a6 Use WP_Screen::add_help_tab(). see #19020
ryan authored
38 get_current_screen()->add_help_tab( array(
39 'id' => 'overview',
40 'title' => __('Overview'),
41 'content' =>
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 Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>'
44 ) );
e62b1ce More help sidebars. see #19020.
nacin authored
45
46 get_current_screen()->set_help_sidebar(
8caed1c Help for multisite. props andrea_r, dougwrites, duck_. see #13467.
nacin authored
47 '<p><strong>' . __('For more information:') . '</strong></p>' .
9cb6e15 Switch from Panel/SubPanel to Screen in inline documentation and Code…
nacin authored
48 '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' .
34c1fa6 target=blank for help. props jorbin, see #13467
nacin authored
49 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
8caed1c Help for multisite. props andrea_r, dougwrites, duck_. see #13467.
nacin authored
50 );
51
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
52 require_once( './admin-header.php' );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
53
54 if ( $updated ) { ?>
53e0be0 Remove references to the old .fade class for message divs.
nacin authored
55 <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
56 <?php } ?>
57
58 <div class="wrap">
59 <?php screen_icon(); ?>
31b71cd Use echo esc_html, not esc_html_e, which also translates.
nacin authored
60 <h2><?php echo esc_html( $title ); ?></h2>
1dda3e0 Don't die in my-sites.php if the user has no sites. Intead, display …
ryan authored
61 <?php
62 if ( empty( $blogs ) ) :
63 echo '<p>';
64 _e( 'You must be a member of at least one site to use this page.' );
65 echo '</p>';
66 else :
67 ?>
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
68 <form id="myblogs" action="" method="post">
69 <?php
70 choose_primary_blog();
71 do_action( 'myblogs_allblogs_options' );
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
72 ?>
73 <br clear="all" />
74 <table class="widefat fixed">
75 <?php
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
76 $settings_html = apply_filters( 'myblogs_options', '', 'global' );
77 if ( $settings_html != '' ) {
442d412 Tweak new strings for better typography. Props demetris. Fixes #12962
dd32 authored
78 echo '<tr><td valign="top"><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
79 echo $settings_html;
442d412 Tweak new strings for better typography. Props demetris. Fixes #12962
dd32 authored
80 echo '</td></tr>';
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
81 }
82 reset( $blogs );
83 $num = count( $blogs );
84 $cols = 1;
85 if ( $num >= 20 )
86 $cols = 4;
87 elseif ( $num >= 10 )
88 $cols = 2;
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
89 $num_rows = ceil( $num / $cols );
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
90 $split = 0;
91 for ( $i = 1; $i <= $num_rows; $i++ ) {
92 $rows[] = array_slice( $blogs, $split, $cols );
93 $split = $split + $cols;
94 }
95
96 $c = '';
97 foreach ( $rows as $row ) {
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
98 $c = $c == 'alternate' ? '' : 'alternate';
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
99 echo "<tr class='$c'>";
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
100 $i = 0;
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
101 foreach ( $row as $user_blog ) {
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
102 $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
103 echo "<td valign='top' style='$s'>";
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
104 echo "<h3>{$user_blog->blogname}</h3>";
172aa06 Revert [14347] and [14372]. It broke more than we expected. Try again…
ryan authored
105 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>";
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
106 echo apply_filters( 'myblogs_options', '', $user_blog );
107 echo "</td>";
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
108 $i++;
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
109 }
110 echo "</tr>";
111 }?>
112 </table>
113 <input type="hidden" name="action" value="updateblogsettings" />
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
114 <?php wp_nonce_field( 'update-my-sites' ); ?>
fc6e89d Expand submit_button() capabilities. Replace all (or almost all) manu…
markjaquith authored
115 <?php submit_button(); ?>
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
116 </form>
1dda3e0 Don't die in my-sites.php if the user has no sites. Intead, display …
ryan authored
117 <?php endif; ?>
1bfbe0d Move 'My Blogs' into its own file. see #11644
ryan authored
118 </div>
119 <?php
d510d0b Huge MS refactoring and code cleanup. see #12460. props ocean90.
markjaquith authored
120 include( './admin-footer.php' );
Something went wrong with that request. Please try again.