Private Post to Published….
-
hey folks,
i have a custom page, where i allow registered user to write new posts.
after they hit submit, they are taken to the post they just submitted and have the chance to edit the design, custom fields, content and everything…now i want to put a button in my sidebar, that lets them publish the post, when they are satisfied with the result.
at this point, every custom field and every content is already transmitted over ajax. so all this button needs to do is to change the post_status from “private” to “publish”…
i have something like that in the sidebar:
<?php if (get_post_status(get_the_ID()) == 'private') { ?> <form id="publish"> <input type="hidden" value="<?php echo get_the_ID(); ?>" name="post_id"/> <input type="submit" value="Veröffentlichen" tabindex="6" id="submit" name="submit" class="btn btn-block btn-warning"/> </form> <?php if ($_POST) { imm_publish_project(); } } ?>and on the other side, the imm_publish_project() looks like this:
function imm_publish_project() { $post = array( 'ID' => $_POST['post_id'], 'post_status' => 'publish', ); wp_update_post($post); }which does nothing… i guess, the
all my users have the “publish_posts” cap…what am i missing?
The topic ‘Private Post to Published….’ is closed to new replies.