Changeset 22967 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 12/02/2012 04:06:31 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/ajax-actions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r22954 r22967 1928 1928 } 1929 1929 1930 function wp_ajax_save_attachment_order() { 1931 if ( ! isset( $_REQUEST['post_id'] ) ) 1932 wp_send_json_error(); 1933 1934 if ( ! $post_id = absint( $_REQUEST['post_id'] ) ) 1935 wp_send_json_error(); 1936 1937 if ( empty( $_REQUEST['attachments'] ) ) 1938 wp_send_json_error(); 1939 1940 check_ajax_referer( 'update-post_' . $post_id, 'nonce' ); 1941 1942 $attachments = $_REQUEST['attachments']; 1943 1944 if ( ! current_user_can( 'edit_post', $post_id ) ) 1945 wp_send_json_error(); 1946 1947 $post = get_post( $post_id, ARRAY_A ); 1948 1949 foreach ( $attachments as $attachment_id => $menu_order ) { 1950 if ( ! current_user_can( 'edit_post', $attachment_id ) ) 1951 continue; 1952 if ( ! $attachment = get_post( $attachment_id ) ) 1953 continue; 1954 if ( 'attachment' != $attachment->post_type ) 1955 continue; 1956 1957 wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order ) ); 1958 } 1959 1960 wp_send_json_success(); 1961 } 1962 1930 1963 /** 1931 1964 * Generates the HTML to send an attachment to the editor.
Note: See TracChangeset
for help on using the changeset viewer.