Title: [Plugin: Quick Press Widget] &#8220;Dewidgetize&#8221; it &#8211; for anonymous posting page
Last modified: August 19, 2016

---

# [Plugin: Quick Press Widget] “Dewidgetize” it – for anonymous posting page

 *  Resolved [rwanito](https://wordpress.org/support/users/rwanito/)
 * (@rwanito)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/)
 * Hi there,
 * I modified quick-press-widget to allow anonymous posting (without registering,
   added a captcha) and include the form in a page instead of in the sidebar (comments
   are in french, ask if you need a translation):
 * **The plugin file :**
 *     ```
       function widget_QPW_init()
   
       {function widget_QPW($args)
   
           {if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' && $_POST['captcha'] == 2010 ) {	check_admin_referer( 'new-post' );
   
       			$user_id		= $current_user->user_id;
   
       			// définir ici l'ID de l'auteur attribué automatiquement
   
       			if (!$user_id) {$user_id = 2;}
   
       			$post_content	= $_POST['posttext'];
   
       			$tags			= $_POST['tags'];
   
       			$char_limit		= 40;
   
       			$post_title		= $_POST['title'];
   
       			$post_name		= $_POST['name'];
   
       			$post_id = wp_insert_post( array(
   
       				'post_author'	=> $user_id,
   
       				'post_title'	=> $post_title,
   
       				'post_content'	=> $post_content,
   
       				'tags_input'	=> $tags,
   
       				'post_status'	=> 'publish'
   
       			) );
   
       		}
   
           }
   
           // Need to register the widget and the control form.
   
           register_sidebar_widget(__('Quick Press Widget', 'QPW'), 'widget_QPW');
   
       }
   
       function widget_QPW_deactivate()
   
       {
   
           delete_option('widget_QPW');
   
       }
   
       register_deactivation_hook(__FILE__, 'widget_QPW_deactivate');
   
       add_action('plugins_loaded', 'widget_QPW_init');
       ```
   
 * **The form :** (include this in a page template)
 *     ```
       <div id="postbox" style="background-color:#EEE; padding: 15px; margin: 5px 0px; -moz-border-radius: 10px; -khtml-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px;" >
       	<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
       		<input type="hidden" name="action" value="post" />
       		<?php wp_nonce_field( 'new-post' ); ?>
       		<label for="title">Titre :</label>
       		<br />
       		<input type="text" name="title" id="title" style="width:95%; height: 25px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" />
       		<br />
       		<label for="posttext">Article :</label>
       		<br />
       		<textarea name="posttext" id="posttext" rows="3" style="width:95%; height: 300px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" ></textarea>
       	  <br />
       		<!-- <label for="tags">Mots-clefs :</label>
       		<br />
       		<input type="text" name="tags" id="tags" style="width:95%; height: 25px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" />
       		<br /> -->
       		<label for="tags"><strong>Anti-robots :</strong> En quelle année sommes-nous ?</label>
       		<br />
       		<input type="text" name="captcha" id="tags" style="width:95%; height: 25px; border: 1px solid #99afbc; margin: 5px 0 10px 0;" />
       		<br />
       		<center><input id="submit" type="submit" value="Publier" style="background-color: #EEE; border: 1px solid #333; color: #333; font-weight: bold; padding: 5px 8px;" /></center>
       	</form>
       </div>
       ```
   
 * **TODO :**
 * I still nedd to activate the plugin **AND** to register the widget in the sidebar
   for this to work.
    I would like to include the plugin file in my functions.php.
 * Do you know which lines I have to copy, wich ones I can erase ?
 * Thanks for sharing !
 * [http://wordpress.org/extend/plugins/quick-press-widget/](http://wordpress.org/extend/plugins/quick-press-widget/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [rwanito](https://wordpress.org/support/users/rwanito/)
 * (@rwanito)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352088)
 * It works !
 * So, this is the lines you need to copy in functions.php :
 *     ```
       function AnonPost($args)
       {
       	if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' && $_POST['captcha'] == 2010 ) {
   
       		check_admin_referer( 'new-post' );
   
       		$user_id		= $current_user->user_id;
       		// définir ici l'ID de l'auteur attribué automatiquement
       		if (!$user_id) {$user_id = 2;}
       		$post_content	= $_POST['posttext'];
       		$tags			= $_POST['tags'];
       		$char_limit		= 40;
       		$post_title		= $_POST['title'];
       		$post_name		= $_POST['name'];
       		$post_id = wp_insert_post( array(
       			'post_author'	=> $user_id,
       			'post_title'	=> $post_title,
       			'post_content'	=> $post_content,
       			'tags_input'	=> $tags,
       			'post_status'	=> 'publish'
       		) );
       	}
       }
       add_action('wp_head', 'AnonPost');
       ```
   
 * With this, you can deactvate the plugin and the widget.
    See up for the form 
   page Thank you dreamcolor
 *  [zvhipp](https://wordpress.org/support/users/zvhipp/)
 * (@zvhipp)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352414)
 * Also way to include category if possible, thanks.
 *  [inapan](https://wordpress.org/support/users/inapan/)
 * (@inapan)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352466)
 * To zvipp: check out the [http://wordpress.org/extend/plugins/quick-post-widget/](http://wordpress.org/extend/plugins/quick-post-widget/)
 *  [craigstruck](https://wordpress.org/support/users/craigstruck/)
 * (@craigstruck)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352530)
 * I need a little more help of how this works. I installed the plug-in and want
   it in the side bar for anyone to make a post. I am very new to this and there
   is a lot of code on this page. Which code do i copy and paste and where. I would
   also need a translated english version. Thanks for your time
 *  [Nigel Parry](https://wordpress.org/support/users/nigelparrydotnet/)
 * (@nigelparrydotnet)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352533)
 * [@rwanito](https://wordpress.org/support/users/rwanito/) Thanks for posting this.
   Have you tried this on WordPress 3 and does it work?
 * Are you/anyone else aware of any other plugins that allow for anonymous publishing,
   and is there a way of confining the posting to a single category?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Quick Press Widget] “Dewidgetize” it – for anonymous posting
page’ is closed to new replies.

 * 5 replies
 * 5 participants
 * Last reply from: [Nigel Parry](https://wordpress.org/support/users/nigelparrydotnet/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-quick-press-widget-dewidgetize-it/#post-1352533)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
