root/trunk/wp-admin/edit-form-advanced.php

Revision 1530, 26.0 kB (checked in by donncha, 4 minutes ago)

WP Merge with revision 9808

  • Property svn:eol-style set to native
Line 
1 <?php
2 /**
3  * Post advanced form for inclusion in the administration panels.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /**
10  * Post ID global
11  * @name $post_ID
12  * @var int
13  */
14 if ( ! isset( $post_ID ) )
15     $post_ID = 0;
16 else
17     $post_ID = (int) $post_ID;
18
19 $action = isset($action) ? $action : '';
20 if ( isset($_GET['message']) )
21     $_GET['message'] = absint( $_GET['message'] );
22 $messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) );
23 $messages[2] = __('Custom field updated.');
24 $messages[3] = __('Custom field deleted.');
25 $messages[4] = __('Post updated.');
26 $messages[6] = sprintf(__('Post published. <a href="%s">View post</a>'), get_permalink($post_ID));
27 $messages[7] = __('Post saved.');
28
29 if ( isset($_GET['revision']) )
30     $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
31
32 $notice = false;
33 $notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
34
35 if ( 0 == $post_ID ) {
36     $form_action = 'post';
37     $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
38     $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
39     $autosave = false;
40 } else {
41     $form_action = 'editpost';
42     $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
43     $autosave = wp_get_post_autosave( $post_ID );
44
45     // Detect if there exists an autosave newer than the post and if that autosave is different than the post
46     if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
47         foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
48             if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
49                 $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
50                 break;
51             }
52         }
53         unset($autosave_field, $_autosave_field);
54     }
55 }
56
57 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
58
59 /**
60  * Display post submit form fields.
61  *
62  * @since 2.7.0
63  *
64  * @param object $post
65  */
66 function post_submit_meta_box($post) {
67     global $action;
68
69     $can_publish = current_user_can('publish_posts');
70 ?>
71 <div class="submitbox" id="submitpost">
72
73 <div id="minor-publishing">
74
75 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
76 <div style="display:none;">
77 <input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
78 </div>
79
80 <div id="minor-publishing-actions">
81 <div id="save-action">
82 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
83 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
84 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
85 <input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
86 <?php } ?>
87 </div>
88
89 <div id="preview-action">
90 <?php $preview_link = 'publish' == $post->post_status ? clean_url(get_permalink($post->ID)) : clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>
91
92 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
93 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
94 </div>
95
96 <div class="clear"></div>
97 </div><?php // /minor-publishing-actions ?>
98
99 <div id="misc-publishing-actions">
100
101 <div class="misc-pub-section<?php if ( !$can_publish ) { echo '  misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
102 <b><span id="post-status-display">
103 <?php
104 switch ( $post->post_status ) {
105     case 'private':
106         _e('Privately Published');
107         break;
108     case 'publish':
109         _e('Published');
110         break;
111     case 'future':
112         _e('Scheduled');
113         break;
114     case 'pending':
115         _e('Pending Review');
116         break;
117     case 'draft':
118         _e('Draft');
119         break;
120 }
121 ?>
122 </span></b>
123 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
124 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
125
126 <div id="post-status-select" class="hide-if-js">
127 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
128 <select name='post_status' id='post_status' tabindex='4'>
129 <?php if ( 'publish' == $post->post_status ) : ?>
130 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
131 <?php elseif ( 'private' == $post->post_status ) : ?>
132 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
133 <?php elseif ( 'future' == $post->post_status ) : ?>
134 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
135 <?php endif; ?>
136 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
137 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
138 </select>
139  <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
140  <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
141 </div>
142
143 <?php } ?>
144 </div><?php // /misc-pub-section ?>
145
146 <div class="misc-pub-section " id="visibility">
147 <?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
148
149 if ( !empty( $post->post_password ) ) {
150     $visibility = 'password';
151     $visibility_trans = __('Password protected');
152 } elseif ( 'private' == $post->post_status ) {
153     $visibility = 'private';
154     $visibility_trans = __('Private');
155 } elseif ( is_sticky( $post->ID ) ) {
156     $visibility = 'public';
157     $visibility_trans = __('Public, Sticky');
158 } else {
159     $visibility = 'public';
160     $visibility_trans = __('Public');
161 }
162
163 ?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
164
165 <div id="post-visibility-select" class="hide-if-js">
166 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attribute_escape($post->post_password); ?>" />
167 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID), true); ?> />
168 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attribute_escape( $visibility ); ?>" />
169
170
171 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
172 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
173 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
174 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attribute_escape($post->post_password); ?>" /><br /></span>
175 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
176
177 <p>
178  <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
179  <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>
180 </p>
181 </div>
182 <?php } ?>
183
184 </div><?php // /misc-pub-section ?>
185
186
187 <?php
188 $datef = _c( 'M j, Y @ G:i|Publish box date format');
189 if ( 0 != $post->ID ) {
190     if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
191         $stamp = __('Scheduled for: <b>%1$s</b>');
192     } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
193         $stamp = __('Published on: <b>%1$s</b>');
194     } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
195         $stamp = __('Publish <b>immediately</b>');
196     } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
197         $stamp = __('Schedule for: <b>%1$s</b>');
198     } else { // draft, 1 or more saves, date specified
199         $stamp = __('Publish on: <b>%1$s</b>');
200     }
201     $date = date_i18n( $datef, strtotime( $post->post_date ) );
202 } else { // draft (no saves, and thus no date specified)
203     $stamp = __('Publish <b>immediately</b>');
204     $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
205 }
206 ?>
207 <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
208 <div class="misc-pub-section curtime misc-pub-section-last">
209     <span id="timestamp">
210     <?php printf($stamp, $date); ?></span>
211     <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
212     <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
213 </div><?php // /misc-pub-section ?>
214 <?php endif; ?>
215
216 </div>
217 <div class="clear"></div>
218 </div>
219
220 <div id="major-publishing-actions">
221 <?php do_action('post_submitbox_start'); ?>
222 <div id="delete-action">
223 <?php
224 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
225 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
226 <?php } ?>
227 </div>
228
229 <div id="publishing-action">
230 <?php
231 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
232 <?php if ( current_user_can('publish_posts') ) : ?>
233     <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
234         <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Schedule') ?>" />
235         <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
236     <?php else : ?>
237         <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Publish') ?>" />
238         <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
239     <?php endif; ?>
240 <?php else : ?>
241     <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Submit for Review') ?>" />
242     <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
243 <?php endif; ?>
244 <?php } else { ?>
245     <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update Post') ?>" />
246     <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Update Post') ?>" />
247 <?php } ?>
248 </div>
249 <div class="clear"></div>
250 </div>
251 </div>
252
253 <?php
254 }
255 add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
256
257 /**
258  * Display post tags form fields.
259  *
260  * @since 2.6.0
261  *
262  * @param object $post
263  */
264 function post_tags_meta_box($post) {
265 ?>
266 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
267 <div id="tagchecklist"></div>
268 <p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p>
269 <?php
270 }
271 add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');
272
273 /**
274  * Display post categories form fields.
275  *
276  * @since 2.6.0
277  *
278  * @param object $post
279  */
280 function post_categories_meta_box($post) {
281 ?>
282 <ul id="category-tabs">
283     <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
284     <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
285 </ul>
286
287 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
288     <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
289         <?php $popular_ids = wp_popular_terms_checklist('category'); ?>
290     </ul>
291 </div>
292
293 <div id="categories-all" class="ui-tabs-panel">
294     <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
295         <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
296     </ul>
297 </div>
298
299 <?php if ( current_user_can('manage_categories') ) : ?>
300 <div id="category-adder" class="wp-hidden-children">
301     <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
302     <p id="category-add" class="wp-hidden-child">
303         <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
304         <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
305         <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
306         <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
307         <span id="category-ajax-response"></span>
308     </p>
309 </div>
310 <?php
311 endif;
312
313 }
314 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
315
316 /**
317  * Display post password form fields.
318  *
319  * @since 2.6.0
320  *
321  * @param object $post
322  */
323 function post_password_meta_box($post) {
324 ?>
325 <p>
326     <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
327 </p>
328 <h4><?php _e( 'Post Password' ); ?></h4>
329 <p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
330 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
331 <?php
332 }
333 // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');
334
335 /**
336  * Display post excerpt form fields.
337  *
338  * @since 2.6.0
339  *
340  * @param object $post
341  */
342 function post_excerpt_meta_box($post) {
343 ?>
344 <label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
345 <p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
346 <?php
347 }
348 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
349
350 /**
351  * Display trackback links form fields.
352  *
353  * @since 2.6.0
354  *
355  * @param object $post
356  */
357 function post_trackback_meta_box($post) {
358     $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
359     if ('' != $post->pinged) {
360         $pings = '<p>'. __('Already pinged:') . '</p><ul>';
361         $already_pinged = explode("\n", trim($post->pinged));
362         foreach ($already_pinged as $pinged_url) {
363             $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
364         }
365         $pings .= '</ul>';
366     }
367
368 ?>
369 <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
370 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
371 <?php
372 if ( ! empty($pings) )
373     echo $pings;
374 }
375 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
376
377 /**
378  * Display custom fields for the post form fields.
379  *
380  * @since 2.6.0
381  *
382  * @param object $post
383  */
384 function post_custom_meta_box($post) {
385 ?>
386 <div id="postcustomstuff">
387 <div id="ajax-response"></div>
388 <?php
389 $metadata = has_meta($post->ID);
390 list_meta($metadata);
391 meta_form();
392 ?>
393 </div>
394 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
395 <?php
396 }
397 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
398
399 do_action('dbx_post_advanced');
400
401 /**
402  * Display comment status for post form fields.
403  *
404  * @since 2.6.0
405  *
406  * @param object $post
407  */
408 function post_comment_status_meta_box($post) {
409     global $wpdb, $post_ID;
410 ?>
411 <input name="advanced_view" type="hidden" value="1" />
412 <p class="meta-options">
413     <label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label><br />
414     <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label>
415 </p>
416 <?php
417     $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
418
419     if ( !$post_ID || $post_ID < 0 || 1 > $total )
420         return;
421
422 wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
423 ?>
424
425 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
426 <thead>
427     <tr>
428     <th scope="col" class="column-comment"><?php _e('Comment') ?></th>
429     <th scope="col" class="column-author"><?php _e('Author') ?></th>
430     <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
431   </tr>
432 </thead>
433 <tbody id="the-comment-list" class="list:comment">
434 </tbody>
435 </table>
436 <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
437 <?php
438     $hidden = (array) get_user_option( "meta-box-hidden_post" );
439     if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
440         <script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
441 <?php
442     }
443 }
444 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
445
446 /**
447  * Display post slug form fields.
448  *
449  * @since 2.6.0
450  *
451  * @param object $post
452  */
453 function post_slug_meta_box($post) {
454 ?>
455 <label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
456 <?php
457 }
458 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
459     add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
460
461 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
462 if ( $post->post_author && !in_array($post->post_author, $authors) )
463     $authors[] = $post->post_author;
464 if ( $authors && count( $authors ) > 1 ) :
465 /**
466  * Display form field with list of authors.
467  *
468  * @since 2.6.0
469  *
470  * @param object $post
471  */
472 function post_author_meta_box($post) {
473     global $current_user, $user_ID;
474     $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
475     if ( $post->post_author && !in_array($post->post_author, $authors) )
476         $authors[] = $post->post_author;
477 ?>
478 <label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
479 <?php
480 }
481 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
482 endif;
483
484 if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
485 /**
486  * Display list of post revisions.
487  *
488  * @since 2.6.0
489  *
490  * @param object $post
491  */
492 function post_revisions_meta_box($post) {
493     wp_list_post_revisions();
494 }
495 add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
496 endif;
497
498 do_action('do_meta_boxes', 'post', 'normal', $post);
499 do_action('do_meta_boxes', 'post', 'advanced', $post);
500 do_action('do_meta_boxes', 'post', 'side', $post);
501
502 require_once('admin-header.php');