duplicate-post
Last commit date
duplicate-post.php
18 years ago
gpl-3.0.txt
18 years ago
make_duplicate_post.php
18 years ago
readme.txt
18 years ago
save_as_new_page.php
18 years ago
save_as_new_post.php
18 years ago
todo.txt
18 years ago
save_as_new_post.php
28 lines
| 1 | <?php |
| 2 | if (!isset( $_GET['post'] ) && !isset( $_POST['post'] )) { |
| 3 | ?> |
| 4 | <div class="wrap"> |
| 5 | <p><strong><?php _e('No post to duplicate has been supplied!', DUPLICATE_POST_I18N_DOMAIN) ?></strong></p> |
| 6 | </div> |
| 7 | <?php |
| 8 | } else { |
| 9 | // Get the original template |
| 10 | $id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']); |
| 11 | $post = duplicate_post_get_post($id); |
| 12 | |
| 13 | // Copy the post and insert it as a template |
| 14 | if (isset($post) && $post!=null) { |
| 15 | $new_id = duplicate_post_create_duplicate_from_post($post); |
| 16 | |
| 17 | // Show the post edit |
| 18 | echo '<meta content="0; URL=post.php?action=edit&post=' . $new_id . '" http-equiv="Refresh" />'; |
| 19 | exit; |
| 20 | } else { |
| 21 | ?> |
| 22 | <div class="wrap"> |
| 23 | <p><strong><?php _e('Post creation failed, could not find original post:', DUPLICATE_POST_I18N_DOMAIN) . ' ' . $id ?></strong></p> |
| 24 | </div> |
| 25 | <?php |
| 26 | } |
| 27 | } |
| 28 | ?> |