3 // Update an existing post with values provided in $_POST.
6 $post_ID = (int) $_POST['post_ID'];
8 if ( 'page' == $_POST['post_type'] ) {
9 if ( !current_user_can( 'edit_page', $post_ID ) )
10 wp_die( __('You are not allowed to edit this page.' ));
12 if ( !current_user_can( 'edit_post', $post_ID ) )
13 wp_die( __('You are not allowed to edit this post.' ));
16 // Autosave shouldn't save too soon after a real save
17 if ( 'autosave' == $_POST['action'] ) {
18 $post =& get_post( $post_ID );
20 $then = strtotime($post->post_date_gmt . ' +0000');
21 $delta = AUTOSAVE_INTERVAL / 2;
22 if ( ($now - $then) < $delta )
27 $_POST['ID'] = (int) $_POST['post_ID'];
28 $_POST['post_content'] = $_POST['content'];
29 $_POST['post_excerpt'] = $_POST['excerpt'];
30 $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
31 $_POST['to_ping'] = $_POST['trackback_url'];
33 if (!empty ( $_POST['post_author_override'] ) ) {
34 $_POST['post_author'] = (int) $_POST['post_author_override'];
36 if (!empty ( $_POST['post_author'] ) ) {
37 $_POST['post_author'] = (int) $_POST['post_author'];
39 $_POST['post_author'] = (int) $_POST['user_ID'];
42 if ( $_POST['post_author'] != $_POST['user_ID'] ) {
43 if ( 'page' == $_POST['post_type'] ) {
44 if ( !current_user_can( 'edit_others_pages' ) )
45 wp_die( __('You are not allowed to edit pages as this user.' ));
47 if ( !current_user_can( 'edit_others_posts' ) )
48 wp_die( __('You are not allowed to edit posts as this user.' ));
53 // What to do based on which button they pressed
54 if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
55 $_POST['post_status'] = 'draft';
56 if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
57 $_POST['post_status'] = 'private';
58 if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
59 $_POST['post_status'] = 'publish';
60 if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
61 $_POST['post_status'] = 'draft';
63 if ( 'page' == $_POST['post_type'] ) {
64 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ))
65 $_POST['post_status'] = 'pending';
67 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ))
68 $_POST['post_status'] = 'pending';
71 if (!isset( $_POST['comment_status'] ))
72 $_POST['comment_status'] = 'closed';
74 if (!isset( $_POST['ping_status'] ))
75 $_POST['ping_status'] = 'closed';
77 foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
78 if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
79 $_POST['edit_date'] = '1';
84 if (!empty ( $_POST['edit_date'] ) ) {
91 $jj = ($jj > 31 ) ? 31 : $jj;
92 $hh = ($hh > 23 ) ? $hh -24 : $hh;
93 $mn = ($mn > 59 ) ? $mn -60 : $mn;
94 $ss = ($ss > 59 ) ? $ss -60 : $ss;
95 $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
96 $_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
100 if ( isset($_POST['meta']) && $_POST['meta'] ) {
101 foreach ( $_POST['meta'] as $key => $value )
102 update_meta( $key, $value['key'], $value['value'] );
105 if ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
106 foreach ( $_POST['deletemeta'] as $key => $value )
110 add_meta( $post_ID );
112 wp_update_post( $_POST );
114 // Reunite any orphaned attachments with their parent
115 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
116 $draft_ids = array();
117 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
118 _relocate_children( $draft_temp_id, $post_ID );
120 // Now that we have an ID we can fix any attachment anchor hrefs
121 _fix_attachment_links( $post_ID );
123 wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
128 // Default post information to use when populating the "Write Post" form.
129 function get_default_post_to_edit() {
130 if ( !empty( $_REQUEST['post_title'] ) )
131 $post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
132 else if ( !empty( $_REQUEST['popuptitle'] ) ) {
133 $post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
134 $post_title = funky_javascript_fix( $post_title );
140 if ( !empty( $_REQUEST['content'] ) )
141 $post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
142 else if ( !empty( $post_title ) ) {
143 $text = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
144 $text = funky_javascript_fix( $text);
145 $popupurl = clean_url($_REQUEST['popupurl']);
146 $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
149 if ( !empty( $_REQUEST['excerpt'] ) )
150 $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
155 $post->post_name = '';
156 $post->post_author = '';
157 $post->post_date = '';
158 $post->post_status = 'draft';
159 $post->post_type = 'post';
162 $post->comment_status = get_option( 'default_comment_status' );
163 $post->ping_status = get_option( 'default_ping_status' );
164 $post->post_pingback = get_option( 'default_pingback_flag' );
165 $post->post_category = get_option( 'default_category' );
166 $post->post_content = apply_filters( 'default_content', $post_content);
167 $post->post_title = apply_filters( 'default_title', $post_title );
168 $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
169 $post->page_template = 'default';
170 $post->post_parent = 0;
171 $post->menu_order = 0;
176 function get_default_page_to_edit() {
177 $page = get_default_post_to_edit();
178 $page->post_type = 'page';
182 // Get an existing post and format it for editing.
183 function get_post_to_edit( $id ) {
185 $post = get_post( $id, OBJECT, 'edit' );
187 if ( $post->post_type == 'page' )
188 $post->page_template = get_post_meta( $id, '_wp_page_template', true );
193 function post_exists($title, $content = '', $post_date = '') {
196 if (!empty ($post_date))
197 $post_date = "AND post_date = '$post_date'";
200 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
202 if (!empty ($content))
203 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
208 // Creates a new post from the "Write Post" form using $_POST information.
209 function wp_write_post() {
212 if ( 'page' == $_POST['post_type'] ) {
213 if ( !current_user_can( 'edit_pages' ) )
214 return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
216 if ( !current_user_can( 'edit_posts' ) )
217 return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
221 // Check for autosave collisions
223 if ( isset($_POST['temp_ID']) ) {
224 $temp_id = (int) $_POST['temp_ID'];
225 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
226 $draft_ids = array();
227 foreach ( $draft_ids as $temp => $real )
228 if ( time() + $temp > 86400 ) // 1 day: $temp is equal to -1 * time( then )
229 unset($draft_ids[$temp]);
231 if ( isset($draft_ids[$temp_id]) ) { // Edit, don't write
232 $_POST['post_ID'] = $draft_ids[$temp_id];
233 unset($_POST['temp_ID']);
234 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
240 $_POST['post_content'] = $_POST['content'];
241 $_POST['post_excerpt'] = $_POST['excerpt'];
242 $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
243 $_POST['to_ping'] = $_POST['trackback_url'];
245 if (!empty ( $_POST['post_author_override'] ) ) {
246 $_POST['post_author'] = (int) $_POST['post_author_override'];
248 if (!empty ( $_POST['post_author'] ) ) {
249 $_POST['post_author'] = (int) $_POST['post_author'];
251 $_POST['post_author'] = (int) $_POST['user_ID'];
256 if ( $_POST['post_author'] != $_POST['user_ID'] ) {
257 if ( 'page' == $_POST['post_type'] ) {
258 if ( !current_user_can( 'edit_others_pages' ) )
259 return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
261 if ( !current_user_can( 'edit_others_posts' ) )
262 return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
267 // What to do based on which button they pressed
268 if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
269 $_POST['post_status'] = 'draft';
270 if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
271 $_POST['post_status'] = 'private';
272 if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
273 $_POST['post_status'] = 'publish';
274 if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
275 $_POST['post_status'] = 'draft';
277 if ( 'page' == $_POST['post_type'] ) {
278 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
279 $_POST['post_status'] = 'pending';
281 if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
282 $_POST['post_status'] = 'pending';
285 if (!isset( $_POST['comment_status'] ))
286 $_POST['comment_status'] = 'closed';
288 if (!isset( $_POST['ping_status'] ))
289 $_POST['ping_status'] = 'closed';
291 foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
292 if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
293 $_POST['edit_date'] = '1';
298 if (!empty ( $_POST['edit_date'] ) ) {
305 $jj = ($jj > 31 ) ? 31 : $jj;
306 $hh = ($hh > 23 ) ? $hh -24 : $hh;
307 $mn = ($mn > 59 ) ? $mn -60 : $mn;
308 $ss = ($ss > 59 ) ? $ss -60 : $ss;
309 $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
310 $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
314 $post_ID = wp_insert_post( $_POST );
315 if ( is_wp_error( $post_ID ) )
318 if ( empty($post_ID) )
321 add_meta( $post_ID );
323 // Reunite any orphaned attachments with their parent
324 if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
325 $draft_ids = array();
326 if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
327 _relocate_children( $draft_temp_id, $post_ID );
328 if ( $temp_id && $temp_id != $draft_temp_id )
329 _relocate_children( $temp_id, $post_ID );
331 // Update autosave collision detection
333 $draft_ids[$temp_id] = $post_ID;
334 update_user_option( $user_ID, 'autosave_draft_ids', $draft_ids );
337 // Now that we have an ID we can fix any attachment anchor hrefs
338 _fix_attachment_links( $post_ID );
340 wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
345 function write_post() {
346 $result = wp_write_post();
347 if( is_wp_error( $result ) )
348 wp_die( $result->get_error_message() );
357 function add_meta( $post_ID ) {
359 $post_ID = (int) $post_ID;
361 $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
363 $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
364 $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
365 $metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
366 $metavalue = $wpdb->escape( $metavalue );
368 if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
369 // We have a key/value pair. If both the select and the
370 // input for the key have data, the input takes precedence:
372 if ('#NONE#' != $metakeyselect)
373 $metakey = $metakeyselect;
376 $metakey = $metakeyinput; // default
378 if ( in_array($metakey, $protected) )
381 wp_cache_delete($post_ID, 'post_meta');
384 INSERT INTO $wpdb->postmeta
385 (post_id,meta_key,meta_value )
386 VALUES ('$post_ID','$metakey','$metavalue' )
388 return $wpdb->insert_id;
393 function delete_meta( $mid ) {
397 $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
398 wp_cache_delete($post_id, 'post_meta');
400 return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
403 // Get a list of previously defined keys
404 function get_meta_keys() {
407 $keys = $wpdb->get_col( "
411 ORDER BY meta_key" );
416 function get_post_meta_by_id( $mid ) {
420 $meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
421 if ( is_serialized_string( $meta->meta_value ) )
422 $meta->meta_value = maybe_unserialize( $meta->meta_value );
426 // Some postmeta stuff
427 function has_meta( $postid ) {
430 return $wpdb->get_results( "
431 SELECT meta_key, meta_value, meta_id, post_id
433 WHERE post_id = '$postid'
434 ORDER BY meta_key,meta_id", ARRAY_A );
438 function update_meta( $mid, $mkey, $mvalue ) {
441 $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
443 if ( in_array($mkey, $protected) )
446 $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
447 wp_cache_delete($post_id, 'post_meta');
449 $mvalue = maybe_serialize( stripslashes( $mvalue ));
450 $mvalue = $wpdb->escape( $mvalue );
452 return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
459 // Replace hrefs of attachment anchors with up-to-date permalinks.
460 function _fix_attachment_links( $post_ID ) {
462 $post = & get_post( $post_ID, ARRAY_A );
464 $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
466 // See if we have any rel="attachment" links
467 if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
471 $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
472 foreach ( $anchor_matches[0] as $anchor ) {
473 if ( 0 == preg_match( $search, $anchor, $id_matches ) )
476 $id = (int) $id_matches[3];
478 // While we have the attachment ID, let's adopt any orphans.
479 $attachment = & get_post( $id, ARRAY_A );
480 if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
481 $attachment['post_parent'] = $post_ID;
482 // Escape data pulled from DB.
483 $attachment = add_magic_quotes( $attachment);
484 wp_update_post( $attachment);
487 $post_search[$i] = $anchor;
488 $post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
492 $post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );
494 // Escape data pulled from DB.
495 $post = add_magic_quotes( $post);
497 return wp_update_post( $post);
500 // Move child posts to a new parent
501 function _relocate_children( $old_ID, $new_ID ) {
503 $old_ID = (int) $old_ID;
504 $new_ID = (int) $new_ID;
505 return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
508 function get_available_post_statuses($type = 'post') {
509 $stati = wp_count_posts($type);
511 return array_keys(get_object_vars($stati));
514 function wp_edit_posts_query( $q = false ) {
518 $q['m'] = (int) $q['m'];
519 $q['cat'] = (int) $q['cat'];
520 $post_stati = array( // array( adj, noun )
521 'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
522 'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
523 'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
524 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
525 'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')),
528 $post_stati = apply_filters('post_stati', $post_stati);
530 $avail_post_stati = get_available_post_statuses('post');
533 if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
534 $post_status_q = '&post_status=' . $q['post_status'];
535 $post_status_q .= '&perm=readable';
538 if ( 'pending' === $q['post_status'] ) {
540 $orderby = 'modified';
541 } elseif ( 'draft' === $q['post_status'] ) {
543 $orderby = 'modified';
549 wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
551 return array($post_stati, $avail_post_stati);
554 function get_available_post_mime_types($type = 'attachment') {
557 $types = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type));
561 function wp_edit_attachments_query( $q = false ) {
565 $q['m'] = (int) $q['m'];
566 $q['cat'] = (int) $q['cat'];
567 $q['post_type'] = 'attachment';
568 $q['post_status'] = 'any';
569 $q['posts_per_page'] = 15;
570 $post_mime_types = array( // array( adj, noun )
571 'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
572 'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
573 'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
575 $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
577 $avail_post_mime_types = get_available_post_mime_types('attachment');
579 if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
580 unset($q['post_mime_type']);
584 return array($post_mime_types, $avail_post_mime_types);
587 function postbox_classes( $id, $page ) {
588 $current_user = wp_get_current_user();
589 if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
590 if ( !is_array( $closed ) ) return '';
591 return in_array( $id, $closed )? 'if-js-closed' : '';
593 if ( 'tagsdiv' == $id || 'categorydiv' == $id ) return '';
594 else return 'if-js-closed';
598 function get_sample_permalink($id, $title=null, $name = null) {
599 $post = &get_post($id);
601 return array('', '');
603 $original_status = $post->post_status;
604 $original_date = $post->post_date;
605 $original_name = $post->post_name;
607 // Hack: get_permalink would return ugly permalink for
608 // drafts, so we will fake, that our post is published
609 if (in_array($post->post_status, array('draft', 'pending'))) {
610 $post->post_status = 'publish';
611 $post->post_date = date('Y-m-d H:i:s');
612 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
615 // If the user wants to set a new name -- override the current one
616 // Note: if empty name is supplied -- use the title instead, see #6072
617 if (!is_null($name)) {
618 $post->post_name = sanitize_title($name? $name : $title, $post->ID);
621 $permalink = get_permalink($post, true);
623 // Handle page hierarchy
624 if ( 'page' == $post->post_type ) {
625 $uri = get_page_uri($post->ID);
626 $uri = untrailingslashit($uri);
627 $uri = strrev( stristr( strrev( $uri ), '/' ) );
628 $uri = untrailingslashit($uri);
631 $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
634 $permalink = array($permalink, $post->post_name);
635 $post->post_status = $original_status;
636 $post->post_date = $original_date;
637 $post->post_name = $original_name;
638 $post->post_title = $original_title;
642 function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
643 $post = &get_post($id);
644 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
645 if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
648 $title = __('Click to edit this part of the permalink');
649 if (strlen($post_name) > 30) {
650 $post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14);
652 $post_name_abridged = $post_name;
654 $post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
655 $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
656 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
657 $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
661 // false: not locked or locked by current user
662 // int: user ID of user with lock
663 function wp_check_post_lock( $post_id ) {
664 global $current_user;
666 if ( !$post = get_post( $post_id ) )
669 $lock = get_post_meta( $post->ID, '_edit_lock', true );
670 $last = get_post_meta( $post->ID, '_edit_last', true );
672 $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
674 if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
679 function wp_set_post_lock( $post_id ) {
680 global $current_user;
681 if ( !$post = get_post( $post_id ) )
683 if ( !$current_user || !$current_user->ID )
688 if ( !add_post_meta( $post->ID, '_edit_lock', $now, true ) )
689 update_post_meta( $post->ID, '_edit_lock', $now );
690 if ( !add_post_meta( $post->ID, '_edit_last', $current_user->ID, true ) )
691 update_post_meta( $post->ID, '_edit_last', $current_user->ID );