Make WordPress Core


Ignore:
Timestamp:
08/11/2006 03:54:45 AM (18 years ago)
Author:
ryan
Message:

Autosave and prototype. Props masquerade. fixes #3020 #3017

File:
1 edited

Legend:

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

    r4049 r4082  
    11<?php
    22
     3function write_post() {
     4    $result = wp_write_post();
     5    if( is_wp_error($result) )
     6        wp_die( $result->get_error_message() );
     7    else
     8        return $result;
     9}
     10
    311// Creates a new post from the "Write Post" form using $_POST information.
    4 function write_post() {
     12function wp_write_post() {
    513    global $user_ID;
    614
    715    if ( 'page' == $_POST['post_type'] ) {
    816        if ( !current_user_can('edit_pages') )
    9             wp_die(__('You are not allowed to create pages on this blog.'));
     17            return new WP_Error('edit_pages', __('You are not allowed to create pages on this blog.'));
    1018    } else {
    1119        if ( !current_user_can('edit_posts') )
    12             wp_die(__('You are not allowed to create posts or drafts on this blog.'));
     20            return new WP_Error('edit_posts', __('You are not allowed to create posts or drafts on this blog.'));
    1321    }
    1422
     
    3341        if ( 'page' == $_POST['post_type'] ) {
    3442            if ( !current_user_can('edit_others_pages') )
    35                 wp_die(__('You cannot create pages as this user.'));
     43                return new WP_Error('edit_others_pages', __('You cannot create pages as this user.'));
    3644        } else {
    3745            if ( !current_user_can('edit_others_posts') )
    38                 wp_die(__('You cannot post as this user.'));
     46                return new WP_Error('edit_others_posts', __('You cannot post as this user.'));
    3947
    4048        }
Note: See TracChangeset for help on using the changeset viewer.