Make WordPress Core

Changeset 12904


Ignore:
Timestamp:
01/29/2010 11:21:01 PM (15 years ago)
Author:
ryan
Message:

Move 'My Blogs' into its own file. see #11644

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r12903 r12904  
    661661add_action( 'admin_notices', 'secret_salt_warning' );
    662662
    663 function profile_update_primary_blog() {
    664     global $current_user;
    665 
    666     $blogs = get_blogs_of_user( $current_user->id );
    667     if ( isset( $blogs[ $_POST[ 'primary_blog' ] ] ) == false ) {
    668         return false;
    669     }
    670 
    671     if ( isset( $_POST['primary_blog'] ) ) {
    672         update_user_option( $current_user->id, 'primary_blog', (int) $_POST['primary_blog'], true );
    673     }
    674 }
    675 add_action ( 'myblogs_update', 'profile_update_primary_blog' );
    676 
    677663function admin_notice_feed() {
    678664    global $current_user;
     
    816802    <?php
    817803}
    818 add_action ( 'myblogs_allblogs_options', 'choose_primary_blog' );
    819804
    820805if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) {
    821806    add_action( 'admin_init', 'update_profile_email' );
    822807}
    823 
    824 function blogs_listing_post() {
    825     if ( !isset( $_POST[ 'action' ] ) ) {
    826         return false;
    827     }
    828     switch( $_POST[ 'action' ] ) {
    829         case "updateblogsettings":
    830             do_action( 'myblogs_update' );
    831         wp_redirect( admin_url( 'index.php?page=myblogs&updated=1' ) );
    832         die();
    833         break;
    834     }
    835 }
    836 add_action( 'admin_init', 'blogs_listing_post' );
    837 
    838 function blogs_listing() {
    839     global $current_user;
    840 
    841     $blogs = get_blogs_of_user( $current_user->ID );
    842     if ( !$blogs || ( is_array( $blogs ) && empty( $blogs ) ) ) {
    843         wp_die( __( 'You must be a member of at least one blog to use this page.' ) );
    844     }
    845 
    846     if ( empty($title) )
    847         $title = apply_filters( 'my_blogs_title', __( 'My Blogs' ) );
    848     ?>
    849     <div class="wrap">
    850     <?php if ( $_GET[ 'updated' ] ) { ?>
    851         <div id="message" class="updated fade"><p><strong><?php _e( 'Your blog options have been updated.' ); ?></strong></p></div>
    852     <?php } ?>
    853     <?php screen_icon(); ?>
    854     <h2><?php echo wp_specialchars( $title ); ?></h2>
    855     <form id="myblogs" action="" method="post">
    856     <?php
    857     do_action( 'myblogs_allblogs_options' );
    858     ?><table class='widefat'> <?php
    859     $settings_html = apply_filters( 'myblogs_options', '', 'global' );
    860     if ( $settings_html != '' ) {
    861         echo "<tr><td valign='top'><h3>" . __( 'Global Settings' ) . "</h3></td><td>";
    862         echo $settings_html;
    863         echo "</td></tr>";
    864     }
    865     reset( $blogs );
    866     $num = count( $blogs );
    867     $cols = 1;
    868     if ( $num >= 20 ) {
    869         $cols = 4;
    870     } elseif ( $num >= 10 ) {
    871         $cols = 2;
    872     }
    873     $num_rows = ceil($num/$cols);
    874     $split = 0;
    875     for( $i = 1; $i <= $num_rows; $i++ ) {
    876         $rows[] = array_slice( $blogs, $split, $cols );
    877         $split = $split + $cols;
    878     }
    879 
    880     foreach( $rows as $row ) {
    881         $c = $c == "alternate" ? "" : "alternate";
    882         echo "<tr class='$c'>";
    883         foreach( $row as $user_blog ) {
    884             $t = $t == "border-right: 1px solid #ccc;" ? "" : "border-right: 1px solid #ccc;";
    885             echo "<td valign='top' style='$t; width:50%'>";
    886             echo "<h3>{$user_blog->blogname}</h3>";
    887             echo "<p>" . apply_filters( "myblogs_blog_actions", "<a href='{$user_blog->siteurl}'>" . __( 'Visit' ) . "</a> | <a href='{$user_blog->siteurl}/wp-admin/'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
    888             echo apply_filters( 'myblogs_options', '', $user_blog );
    889             echo "</td>";
    890         }
    891         echo "</tr>";
    892     }?>
    893     </table>
    894     <input type="hidden" name="action" value="updateblogsettings" />
    895     <p>
    896      <input type="submit" class="button-primary" value="<?php _e('Update Options') ?>" name="submit" />
    897     </p>
    898     </form>
    899     </div>
    900     <?php
    901 }
    902 
    903 function blogs_page_init() {
    904     global $current_user;
    905     $all_blogs = get_blogs_of_user( $current_user->ID );
    906     if ( $all_blogs != false && !empty( $all_blogs ) ) {
    907         $title = apply_filters( 'my_blogs_title', __( 'My Blogs' ) );
    908         add_submenu_page( 'index.php', $title, $title, 'read', 'myblogs', 'blogs_listing' );
    909     }
    910 }
    911 add_action('admin_menu', 'blogs_page_init');
    912808
    913809function stripslashes_from_options( $blog_id ) {
  • trunk/wp-admin/menu.php

    r12845 r12904  
    2727
    2828$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
     29if ( is_multisite() ) {
     30    $submenu[ 'index.php' ][0] = array( __('Dashboard'), 'read', 'index.php' );
     31    $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
     32}
    2933
    3034if ( is_multisite() && is_super_admin() ) {
Note: See TracChangeset for help on using the changeset viewer.