Make WordPress Core

Changeset 6712


Ignore:
Timestamp:
02/02/2008 07:22:14 PM (16 years ago)
Author:
ryan
Message:

Don't hard code post type in edit forms. Props filosofo and DD32. fixes #4991

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r6633 r6712  
    4747$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
    4848
    49 if (empty($post->post_status)) $post->post_status = 'draft';
    50 
    5149?>
    5250
     
    5553<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
    5654<input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
    57 <input type="hidden" id="post_type" name="post_type" value="post" />
     55<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
    5856
    5957<?php echo $form_extra ?>
  • trunk/wp-admin/edit-page-form.php

    r6671 r6712  
    2828wp_nonce_field($nonce_action);
    2929
    30 if (isset($mode) && 'bookmarklet' == $mode) {
     30if (isset($mode) && 'bookmarklet' == $mode)
    3131    echo '<input type="hidden" name="mode" value="bookmarklet" />';
    32 }
    3332?>
    3433<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
     
    3635<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
    3736<?php echo $form_extra ?>
    38 <input type="hidden" id="post_type" name="post_type" value="page" />
     37<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
    3938
    4039<script type="text/javascript">
  • trunk/wp-admin/includes/post.php

    r6633 r6712  
    144144
    145145    $post->post_status = 'draft';
     146    $post->post_type = 'post';
    146147    $post->comment_status = get_option( 'default_comment_status' );
    147148    $post->ping_status = get_option( 'default_ping_status' );
     
    156157
    157158    return $post;
     159}
     160
     161function get_default_page_to_edit() {
     162    $page = get_default_post_to_edit();
     163    $page->post_type = 'page';
     164    return $page;
    158165}
    159166
  • trunk/wp-admin/page-new.php

    r6665 r6712  
    1919if ( current_user_can('edit_pages') ) {
    2020    $action = 'post';
    21     $post = get_default_post_to_edit();
    22     $post->post_type = 'page';
     21    $post = get_default_page_to_edit();
    2322
    2423    include('edit-page-form.php');
  • trunk/wp-includes/default-filters.php

    r6493 r6712  
    6161foreach ( $filters as $filter ) {
    6262    add_filter($filter, 'sanitize_title');
     63}
     64
     65// Keys
     66$filters = array('pre_post_type');
     67foreach ( $filters as $filter ) {
     68    add_filter($filter, 'sanitize_user');
    6369}
    6470
Note: See TracChangeset for help on using the changeset viewer.