<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12905] trunk/wp-admin/my-sites.php: Move 'My Blogs' into its own file.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12905">12905</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-29 23:21:33 +0000 (Fri, 29 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move 'My Blogs' into its own file. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmysitesphp">trunk/wp-admin/my-sites.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmysitesphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/my-sites.php (0 => 12905)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/my-sites.php                                (rev 0)
+++ trunk/wp-admin/my-sites.php        2010-01-29 23:21:33 UTC (rev 12905)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+&lt;?php
+
+require_once('admin.php');
+
+if ( !is_multisite() )
+        wp_die( __('Multisite support is not enabled.') );
+
+if ( ! current_user_can('read') )
+        wp_die(__('You do not have sufficient permissions to view this page.'));
+
+$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
+
+$blogs = get_blogs_of_user( $current_user-&gt;id );
+
+if ( empty( $blogs ) )
+        wp_die( __( 'You must be a member of at least one site to use this page.' ) );
+
+$updated = false;
+if ( 'updateblogsettings' == $action &amp;&amp; isset( $_POST['primary_blog'] ) ) {
+        check_admin_referer('update-my-sites');
+        // @todo Validate primary blog.
+        update_user_option( $current_user-&gt;id, 'primary_blog', (int) $_POST['primary_blog'], true );
+        $updated = true;
+}
+
+$title = __('My Sites');
+$parent_file = 'index.php';
+require_once('admin-header.php');
+
+if ( $updated ) { ?&gt;
+                &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;strong&gt;&lt;?php _e( 'Your site preferences have been updated.' ); ?&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;?php } ?&gt;
+
+&lt;div class=&quot;wrap&quot;&gt;
+&lt;?php screen_icon(); ?&gt;
+&lt;h2&gt;&lt;?php echo esc_html($title); ?&gt;&lt;/h2&gt;
+&lt;form id=&quot;myblogs&quot; action=&quot;&quot; method=&quot;post&quot;&gt;
+        &lt;?php
+        choose_primary_blog();
+        do_action( 'myblogs_allblogs_options' );
+        ?&gt;&lt;table class='widefat'&gt; &lt;?php
+        $settings_html = apply_filters( 'myblogs_options', '', 'global' );
+        if ( $settings_html != '' ) {
+                echo &quot;&lt;tr&gt;&lt;td valign='top'&gt;&lt;h3&gt;&quot; . __( 'Global Settings' ) . &quot;&lt;/h3&gt;&lt;/td&gt;&lt;td&gt;&quot;;
+                echo $settings_html;
+                echo &quot;&lt;/td&gt;&lt;/tr&gt;&quot;;
+        }
+        reset( $blogs );
+        $num = count( $blogs );
+        $cols = 1;
+        if ( $num &gt;= 20 )
+                $cols = 4;
+        elseif ( $num &gt;= 10 )
+                $cols = 2;
+        $num_rows = ceil($num/$cols);
+        $split = 0;
+        for ( $i = 1; $i &lt;= $num_rows; $i++ ) {
+                $rows[] = array_slice( $blogs, $split, $cols );
+                $split = $split + $cols;
+        }
+
+        $c = '';
+        foreach ( $rows as $row ) {
+                $c = $c == &quot;alternate&quot; ? '' : 'alternate';
+                echo &quot;&lt;tr class='$c'&gt;&quot;;
+                $t = '';
+                foreach ( $row as $user_blog ) {
+                        $t = $t == 'border-right: 1px solid #ccc;' ? '' : 'border-right: 1px solid #ccc;';
+                        echo &quot;&lt;td valign='top' style='$t; width:50%'&gt;&quot;;
+                        echo &quot;&lt;h3&gt;{$user_blog-&gt;blogname}&lt;/h3&gt;&quot;;
+                        echo &quot;&lt;p&gt;&quot; . apply_filters( &quot;myblogs_blog_actions&quot;, &quot;&lt;a href='{$user_blog-&gt;siteurl}'&gt;&quot; . __( 'Visit' ) . &quot;&lt;/a&gt; | &lt;a href='{$user_blog-&gt;siteurl}/wp-admin/'&gt;&quot; . __( 'Dashboard' ) . &quot;&lt;/a&gt;&quot;, $user_blog ) . &quot;&lt;/p&gt;&quot;;
+                        echo apply_filters( 'myblogs_options', '', $user_blog );
+                        echo &quot;&lt;/td&gt;&quot;;
+                }
+                echo &quot;&lt;/tr&gt;&quot;;
+        }?&gt;
+        &lt;/table&gt;
+        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;updateblogsettings&quot; /&gt;
+        &lt;?php wp_nonce_field('update-my-sites'); ?&gt;
+        &lt;p&gt;
+         &lt;input type=&quot;submit&quot; class=&quot;button-primary&quot; value=&quot;&lt;?php _e('Update Options') ?&gt;&quot; name=&quot;submit&quot; /&gt;
+        &lt;/p&gt;
+        &lt;/form&gt;
+        &lt;/div&gt;
+&lt;?php
+include('admin-footer.php');
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/my-sites.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre>
</div>
</div>

</body>
</html>