Make WordPress Core

Changeset 2524


Ignore:
Timestamp:
04/09/2005 05:25:47 PM (20 years ago)
Author:
ryan
Message:

Make get_postdata() use get_post(). Label get_postdata() as deprecated. Remove the one remaining call to get_postdata().

Location:
trunk
Files:
2 edited

Legend:

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

    r2496 r2524  
    208208        die ( __('You are not allowed to edit this post.') );
    209209       
    210     $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
     210    $postdata = &get_post($post_ID);
    211211    $content = $postdata->post_content;
    212212    $content = format_to_edit($content);
     
    238238    }
    239239
    240     $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
     240    $post = &$postdata;
    241241    ?>
    242242    <div id='preview' class='wrap'>
     
    528528    }
    529529
    530     $postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
     530    $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    531531    $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
    532532
  • trunk/wp-includes/functions.php

    r2523 r2524  
    462462}
    463463
     464// Deprecated.  Use get_post().
    464465function get_postdata($postid) {
    465     global $post, $wpdb;
    466 
    467     if ( $postid == $post->ID )
    468         $a_post = $post;
    469     else
    470         $a_post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'");
     466    $post = &get_post($postid);
    471467   
    472468    $postdata = array (
    473         'ID' => $a_post->ID,
    474         'Author_ID' => $a_post->post_author,
    475         'Date' => $a_post->post_date,
    476         'Content' => $a_post->post_content,
    477         'Excerpt' => $a_post->post_excerpt,
    478         'Title' => $a_post->post_title,
    479         'Category' => $a_post->post_category,
    480         'post_status' => $a_post->post_status,
    481         'comment_status' => $a_post->comment_status,
    482         'ping_status' => $a_post->ping_status,
    483         'post_password' => $a_post->post_password,
    484         'to_ping' => $a_post->to_ping,
    485         'pinged' => $a_post->pinged,
    486         'post_name' => $a_post->post_name
     469        'ID' => $post->ID,
     470        'Author_ID' => $post->post_author,
     471        'Date' => $post->post_date,
     472        'Content' => $post->post_content,
     473        'Excerpt' => $post->post_excerpt,
     474        'Title' => $post->post_title,
     475        'Category' => $post->post_category,
     476        'post_status' => $post->post_status,
     477        'comment_status' => $post->comment_status,
     478        'ping_status' => $post->ping_status,
     479        'post_password' => $post->post_password,
     480        'to_ping' => $post->to_ping,
     481        'pinged' => $post->pinged,
     482        'post_name' => $post->post_name
    487483    );
     484
    488485    return $postdata;
    489486}
Note: See TracChangeset for help on using the changeset viewer.