Changeset 4082 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 08/11/2006 03:54:45 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r4049 r4082 1 1 <?php 2 2 3 function 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 3 11 // Creates a new post from the "Write Post" form using $_POST information. 4 function w rite_post() {12 function wp_write_post() { 5 13 global $user_ID; 6 14 7 15 if ( 'page' == $_POST['post_type'] ) { 8 16 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.')); 10 18 } else { 11 19 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.')); 13 21 } 14 22 … … 33 41 if ( 'page' == $_POST['post_type'] ) { 34 42 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.')); 36 44 } else { 37 45 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.')); 39 47 40 48 }
Note: See TracChangeset
for help on using the changeset viewer.