Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am newbie in wordpress. Is it possible to allow unregistered users submit a post and put it in a queue to get confirmed with site admin and when be shown on the site?

share|improve this question
add comment

2 Answers

UPDATE - i made a simple plugin for this that adds the functionality:

  1. A widget that you can put in your sidebar that enables post to bee saved as pendling
  2. A widget that displays the three last submitted and confirmed posts.

The plugin have som simple css classes without any styling.

Here is the download link: Simple Frontend post

The function and form:

To get this to work you can use the function wp_insert_post to insert post/pages into the database, It sanitizes variables, does some checks, fills in missing variables like date/time, etc.

First you need a form to get all the necessary content that you need.

Here is a form that enables title and text content, put it where you want your form:

<form action="<?php echo site_url(); ?>/" method="post">
    <input type="text" id="title" value="" tabindex="5" name="title" />
    <textarea tabindex="3" name="desc" cols="5" rows="3"></textarea>
    <input type="submit" value="Submit" name="frontendpost">
</form>

And here is the function that put all the content into the database and save it as pendling, i.e you have to confirm it first before it will be seen on the front, put it into your funtions.php theme file:

<?php
    //Enable the front-end postings
    function save_frontend_post() {

        if ( !empty( $_POST ) && isset( $_POST['frontendpost'] ) ) {

            //Check to make sure that the post title field is not empty
            if( trim( $_POST['title'] ) === '' ) {
                $error = true;
            } else {
               $title = trim( $_POST['title'] );
            }

            //Check to make sure sure that content is submitted
            if( trim( $_POST['desc'] ) === '' )  {
                $error = true;
            } else {
               $desc = trim( $_POST['desc'] );
            }

            //If there is no error, send the form
            if( !isset( $error ) ) {

                //Create post object
                $new_post = array(
                    'post_title'     => $title,              //The title of your post.
                    'post_content'   => $desc,               //The full text of the post.
                    'post_date'      => date('Y-m-d H:i:s'), //The time post was made.
                    'post_status'    => 'pending',           //Set the status of the new post.
                    'post_type'      => 'post'
                );

                //Insert the post into the database
                $new_post = wp_insert_post( $new_post );        

            }
        }
    }
    add_action( 'wp_head', 'save_frontend_post', 10, 2 );
?>
share|improve this answer
    
The dropbox link is dead, have you considered uploading it to the WP plugin archives or github? –  Christine Cooper Nov 7 '13 at 16:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.