Make WordPress Core


Ignore:
Timestamp:
07/08/2005 10:59:15 PM (21 years ago)
Author:
matt
Message:

Drafts clean up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r2692 r2701  
    323323<?php endif; ?>
    324324<?php
    325     if (user_can_create_draft($user_ID)) {
     325    if ( user_can_create_draft($user_ID) ) {
    326326        $action = 'post';
    327327        get_currentuserinfo();
    328         $drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
    329         if ($drafts) {
     328        if ( $drafts = get_users_drafts( $user_ID ) ) {
    330329            ?>
    331330            <div class="wrap">
    332331            <p><strong><?php _e('Your Drafts:') ?></strong>
    333332            <?php
    334             $i = 0;
    335             foreach ($drafts as $draft) {
    336                 if (0 != $i)
     333            for ( $i = 0; $i < 15; $i++ ) {
     334                $draft = $drafts[$i];
     335                if ( 0 != $i )
    337336                    echo ', ';
    338337                $draft->post_title = stripslashes($draft->post_title);
    339                 if ($draft->post_title == '')
     338                if ( empty($draft->post_title) )
    340339                    $draft->post_title = sprintf(__('Post # %s'), $draft->ID);
    341340                echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
    342                 ++$i;
    343                 }
    344             ?>.</p>
     341            }
     342            ?>
     343            <?php if ( 15 < count($drafts) ) { ?>
     344            , <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> &raquo;</a>
     345            <?php } ?>
     346            .</p>
    345347            </div>
    346348            <?php
Note: See TracChangeset for help on using the changeset viewer.