Make WordPress Core

Ticket #31168: 31168.7.diff

File 31168.7.diff, 5.0 KB (added by valendesigns, 10 years ago)
  • src/wp-admin/includes/post.php

    diff --git src/wp-admin/includes/post.php src/wp-admin/includes/post.php
    index 1be4868..2ab5335 100644
    function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) 
    610610                $post->post_status = 'draft';
    611611                $post->to_ping = '';
    612612                $post->pinged = '';
    613                 $post->comment_status = get_option( 'default_comment_status' );
    614                 $post->ping_status = get_option( 'default_ping_status' );
     613                $post->comment_status = get_default_comment_status( $post_type );
     614                $post->ping_status = get_default_comment_status( $post_type, 'pingback' );
    615615                $post->post_pingback = get_option( 'default_pingback_flag' );
    616616                $post->post_category = get_option( 'default_category' );
    617617                $post->page_template = 'default';
  • src/wp-admin/post.php

    diff --git src/wp-admin/post.php src/wp-admin/post.php
    index 65140aa..9ff7f31 100644
    case 'post-quickdraft-save': 
    129129        $post = get_post( $_REQUEST['post_ID'] );
    130130        check_admin_referer( 'add-' . $post->post_type );
    131131
    132         $_POST['comment_status'] = get_option( 'default_comment_status' );
    133         $_POST['ping_status'] = get_option( 'default_ping_status' );
     132        $_POST['comment_status'] = get_default_comment_status( $post->post_type );
     133        $_POST['ping_status'] = get_default_comment_status( $post->post_type, 'pingback' );
    134134
    135135        edit_post();
    136136        wp_dashboard_quick_press();
  • src/wp-includes/class-wp-xmlrpc-server.php

    diff --git src/wp-includes/class-wp-xmlrpc-server.php src/wp-includes/class-wp-xmlrpc-server.php
    index 4a68aaa..0573b71 100644
    class wp_xmlrpc_server extends IXR_Server { 
    48094809                                                $comment_status = 'open';
    48104810                                                break;
    48114811                                        default:
    4812                                                 $comment_status = get_option('default_comment_status');
     4812                                                $comment_status = get_default_comment_status( $post_type );
    48134813                                                break;
    48144814                                }
    48154815                        } else {
    class wp_xmlrpc_server extends IXR_Server { 
    48224822                                                $comment_status = 'open';
    48234823                                                break;
    48244824                                        default:
    4825                                                 $comment_status = get_option('default_comment_status');
     4825                                                $comment_status = get_default_comment_status( $post_type );
    48264826                                                break;
    48274827                                }
    48284828                        }
    48294829                } else {
    4830                         $comment_status = get_option('default_comment_status');
     4830                        $comment_status = get_default_comment_status( $post_type );
    48314831                }
    48324832
    48334833                if ( isset($content_struct['mt_allow_pings']) ) {
    class wp_xmlrpc_server extends IXR_Server { 
    48404840                                                $ping_status = 'open';
    48414841                                                break;
    48424842                                        default:
    4843                                                 $ping_status = get_option('default_ping_status');
     4843                                                $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48444844                                                break;
    48454845                                }
    48464846                        } else {
    class wp_xmlrpc_server extends IXR_Server { 
    48524852                                                $ping_status = 'open';
    48534853                                                break;
    48544854                                        default:
    4855                                                 $ping_status = get_option('default_ping_status');
     4855                                                $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48564856                                                break;
    48574857                                }
    48584858                        }
    48594859                } else {
    4860                         $ping_status = get_option('default_ping_status');
     4860                        $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48614861                }
    48624862
    48634863                if ( $post_more )
    class wp_xmlrpc_server extends IXR_Server { 
    51205120                                                $comment_status = 'open';
    51215121                                                break;
    51225122                                        default:
    5123                                                 $comment_status = get_option('default_comment_status');
     5123                                                $comment_status = get_default_comment_status( $post_type );
    51245124                                                break;
    51255125                                }
    51265126                        } else {
    class wp_xmlrpc_server extends IXR_Server { 
    51335133                                                $comment_status = 'open';
    51345134                                                break;
    51355135                                        default:
    5136                                                 $comment_status = get_option('default_comment_status');
     5136                                                $comment_status = get_default_comment_status( $post_type );
    51375137                                                break;
    51385138                                }
    51395139                        }
    class wp_xmlrpc_server extends IXR_Server { 
    51495149                                                $ping_status = 'open';
    51505150                                                break;
    51515151                                        default:
    5152                                                 $ping_status = get_option('default_ping_status');
     5152                                                $ping_status = get_default_comment_status( $post_type, 'pingback' );
    51535153                                                break;
    51545154                                }
    51555155                        } else {
    class wp_xmlrpc_server extends IXR_Server { 
    51615161                                                $ping_status = 'open';
    51625162                                                break;
    51635163                                        default:
    5164                                                 $ping_status = get_option('default_ping_status');
     5164                                                $ping_status = get_default_comment_status( $post_type, 'pingback' );
    51655165                                                break;
    51665166                                }
    51675167                        }
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 52600b8..3921ec6 100644
    function get_default_comment_status( $post_type = 'post', $comment_type = 'comme 
    41114111         *
    41124112         * @param string $status       Default status for the given post type,
    41134113         *                             either 'open' or 'closed'.
    4114          * @param string $comment_type Type of comment. Default is `comment`.
     4114         * @param string $post_type    Post type. Default is `post`.
     4115         * @param string $comment_type Comment type. Default is `comment`.
    41154116         */
    4116         return apply_filters( "get_{$post_type}_default_comment_status", $status, $comment_type );
     4117        return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );
    41174118}
    41184119
    41194120/**