function message_post() { check_ajax_referer('mdrop_nonce'); if (!isset($_POST['message_id'])) { wp_send_json_error(); } if (isset($_POST['message_id']) && !count($_POST['message_id'])) { wp_send_json_error(); } $mail_ids = $_POST['message_id']; foreach ($mail_ids as $key => $post_id) { $mail_post = get_post($post_id); $attach_content = ''; $get_attachemt_ids = get_post_meta($post_id, '_wp_attachment_id'); foreach ($get_attachemt_ids as $attach_key => $get_attachemt_id) { $thumbs = mdrop_get_file($get_attachemt_id); $url = $thumbs['url']; $name = $thumbs['name']; $thumb = $thumbs['thumb']; $attach_content = '<a href="' . $url . '" title="' . $name . '"> <img src="' . $thumb . '" class="mdrop-file"> </a>'; } wp_insert_post(array('post_type' => 'post', 'post_title' => $mail_post->post_title, 'post_content' => $mail_post->post_content . $attach_content, 'post_status' => 'publish')); } wp_send_json_success(); }
echo $message->ID; ?> "><?php _e('Delete', 'mdrop'); ?> </a> </div> </td> <td><?php echo get_post_meta($message->ID, '_date', true); ?> </td> <td><?php foreach ($get_attachemt_ids as $snum => $attachemt_id) { $thumbs = mdrop_get_file($attachemt_id); ?> <a href="<?php echo $thumbs['url']; ?> " title="<?php echo $thumbs['name']; ?> "> <img src="<?php echo $thumbs['thumb']; ?> " class="mdrop-file"> </a> <?php