Spring Sale! Save 30% on all books w/ code: PLANET24
Web Dev + WordPress + Security

WordPress Plugin: User Submitted Posts

[ User Submitted Posts ]

User Submitted Posts enables your visitors to submit posts and images from anywhere on your site via template tag or shortcode. User-submitted posts optionally include tags, categories, post titles, and more. You can set submitted posts as draft, publish immediately, or after some number of approved posts. Also enables users to upload multiple images when submitting a post. Everything super-easy to customize via Admin Settings page.

Update! Pro version of User Submitted Posts now available — check it out »

Let your visitors submit content

User Submitted Posts makes it easy to display a public post-submission form virtually anywhere on your site. Use the USP shortcode to display the submission form in any post or page, or use the USP template tag to include the form anywhere in your theme design. Visitors may then use the form to submit posts to your site. Depending on your preferences, user-submitted posts may include the following input fields:

  • Name
  • Email
  • URL
  • Post Title
  • Post Tags
  • Post Category
  • Post Content
  • Custom Field
  • Challenge Question
  • Google reCAPTCHA
  • Post Images

Using the Settings Page, you choose which fields to display, min/max number of images, min/max image size, redirect location, error messages and more. User Submitted Posts makes it easy to setup just about any type of user-submitted functionality for your WordPress-powered site. Here are some examples of how the USP plugin could be used:

  • Public Submit a Link form with tags
  • Simple Submit News form with post, title & author
  • Use as Contact Form that allows image attachments
  • Use as an Image Uploader, maybe with tags, title or whatever

Once a user has submitted a post, it’s saved as a “Draft” by default, but may optionally be set to “Publish Immediately” or even to publish if the author has “x” number of approved submissions. The plugin also displays a User Submitted Posts button at the top of the Posts Page that lets you filter all user-submitted posts/drafts with the click of a button.

Features

  • Let visitors submit posts from anywhere on your site
  • Use template tag or shortcode to display the form anywhere
  • Includes customizable captcha and hidden field to stop spam
  • Submitted posts may include any/all of the available fields
  • Redirect user anywhere after successful post submission
  • Includes template tags for displaying submitted content
  • New HTML5 submission form with streamlined CSS styles

Image Uploads

  • Optionally allow/require visitors to upload any number of images
  • Specify minimum and maximum width and height for uploaded images
  • Specicy min/max number of allowed image uploads for each post
  • Includes jQuery snippet for easy choosing of multiple images

Customization

  • Control which fields are displayed in the submission form
  • Choose which categories users are allowed to select
  • Assign submitted posts to any registered user
  • Customizable success, error, and upload messages
  • Plus options for the captcha, auto-publish, and redirect-URL
  • Choose form style: Classic, HTML5, or plain (disable styles)

Post Management

  • Custom Fields saved w/ each post: name, IP, URL, images, et al
  • Set submitted posts to any status: Draft, Publish, or Moderate
  • One-click post-filtering of submitted posts in the Admin Area
  • Includes template tags for easy display of submitted images

Installation & Usage

Overview

  1. Install USP just like any other WordPress plugin
  2. Go to the “User Submitted Posts” settings and customize your options
  3. Display the submission form on your page(s) using template tag or shortcode

Displaying the submission form

To display the form on a post or page, use the shortcode:

[user-submitted-posts]

To display the form anywhere in your theme, use the template tag:

<?php if (function_exists('user_submitted_posts')) user_submitted_posts(); ?>

Customizing the submission form

  • To style the submission form, use the included CSS file located at: /resources/usp.css
  • To add custom JavaScript, use the included JS file located at: /resources/usp.js

Customizing user-submitted posts

User-submitted posts are just like any other post, with the exception that they each contain a set of custom fields. The custom fields include extra information about the post:

  • is_submission – indicates that the post is in fact user-submitted
  • user_submit_image – URLs of any submitted images (one field per image)
  • user_submit_ip – the IP address of the submitted-post author
  • user_submit_name – the name of the submitted-post author
  • user_submit_url – the submitted URL

So when user-submitted posts are displayed on your website, say on the home page or single-view, these custom fields are available to you in your theme files. This enables you to customize the user-submitted posts by displaying the submitted name, URL, images, and so forth. Here are two articles for those new to using WordPress custom-fields:

Template Tags

Additionally, the USP plugin also includes a set of template tags for customizing your user-submitted posts:

usp_is_public_submission()
Returns a boolean value indicating whether the specified post is a public submission
Usage: <?php if (function_exists('usp_is_public_submission')) usp_is_public_submission(); ?>

usp_get_post_images()
Returns an array of URLs for the specified post image
Usage: <?php $images = usp_get_post_images(); foreach ($images as $image) { echo $image; } ?>

usp_post_attachments()
Prints the URLs for all post attachments.
Usage:  <?php if (function_exists('usp_post_attachments')) usp_post_attachments(); ?>
Syntax: <?php if (function_exists('usp_post_attachments')) usp_post_attachments($size, $beforeUrl, $afterUrl, $numberImages, $postId); ?>
Paramters:
    $size         = image size as thumbnail, medium, large or full -> default = full
    $beforeUrl    = text/markup displayed before the image URL     -> default = <img src="
    $afterUrl     = text/markup displayed after the image URL      -> default = " />
    $numberImages = the number of images to display for each post  -> default = false (display all)
    $postId       = an optional post ID to use                     -> default = uses global post

usp_author_link()
For public-submitted posts, this tag displays the author's name as a link (if URL provided) or plain text (if URL not provided)
For normal posts, this tag displays the author's name as a link to their author's post page
Usage: <?php if (function_exists('usp_author_link')) usp_author_link(); ?>

For more tags, check out USP at WordPress.org, and/or the source code of the plugin file located at: /library/template-tags.php

Screenshots

Here are some screenshots of the USP plugin:

Note: these screenshots were taken awhile ago. For fresh screenshots from more recent versions of the plugin, check out USP at WordPress.org.

Download & Demo

To download the free version of User Submitted Posts, visit the plugin homepage at the WordPress.org Plugin Directory.

About the Author
Jeff Starr = Creative thinker. Passionate about free and open Web.
Blackhole Pro: Trap bad bots in a virtual black hole.

120 responses to “WordPress Plugin: User Submitted Posts”

  1. Is there any way to set up Verve Custom Fields style boxes for user-submitted stuff? One could conceivably create a completely user generated site of any kind, anything from Yelp-type reviews to Craigslist-type classifieds.

  2. So would the admin be emailed when a user submits a post?

    Could a terms and conditions check box be added to the submit form before any images or content could be uploaded? (They own or have rights to the image, no affiliate links in article, article is original not PLR content, etc.)

    This could really open up Guest Posts to all WP sites.

    Thank you for posting this.

    • So would the admin be emailed when a user submits a post?

      USP doesn’t send emails by default, but I’ve seen other plugins that should enable that sort of functionality.

      For the “Terms and Conditions”, there is a field in the Settings that may be used to include some text/markup, but the plugin would need modified to include a checkbox.

      I like the idea and will see about including it in the next update. Thanks :)

      • Harsh Agrawal 2011/03/07 7:23 am

        Plugin looks very neat and clean and useful for blog which offers quick tip submission.
        For user notification you can use wp status notifier plugin.

      • Yes please – checkbox linked to tandCs would be a huge help

  3. Just about to try out this plugin as I think it may finally help me achieve the functionality I’ve been fighting for for nearly a year (wordpress may be flexible, but it’s bloody stubborn at times! X-D )…

    I do have a question though – could it also be used to upload video files? I’m assuming this would only require the addition of an extra upload field configured to upload various video files, but my enthusiasm has a habit of breaking my toys so thought I should check with you first… :-D

    • Jeff Starr 2011/02/21 3:06 pm

      Awesome, great to hear :)

      The plugin is designed for image uploads, and includes a variety of mechanisms to ensure min/max size, upload limits, and so on. I’m sure it’s possible to enable uploads of other file types, but maybe not as straightforward as adding a custom/input fields.

  4. Hi!
    Try to use it, but i see strange simbols instead category in admin panel, and autors name too, when I submit post. It is becouse I use cyrillic simbols (utf-8). How i can fix it? Thanks in advance!

    • Jeff Starr 2011/02/21 3:48 pm

      A translation file may be needed for other languages.. not sure about the cyrillic symbols.

      • I confirm this problem. Wrong symbols instead of the author name and cat name. Is there anyway to fix this myself?

  5. Hi

    I’m getting an error saying the plugin doesn’t have a valid header. Using Genesis theme framework.

    Thx

    • Jeff Starr 2011/02/21 3:42 pm

      The only thing I can think of is maybe the /user-submitted-posts/ directory is nested within the extra plugin directory created by WP Plugin Directory for the zip file..

      • AJ Morris 2011/02/21 6:35 pm

        Hi Jeff, Just wanted to let you know that I get the same error when using the Headway Theme framework as well. Would be great if you could fix this. If you need a copy of Headway to test against, please let me know.

        Great work so far!

        -AJ

      • Jeff Starr 2011/02/21 9:08 pm

        Yes, thank you – the issue was with an extra/outer user-submitted-posts folder that the repository was wrapping the existing plugin with when creating the downloadable zip file. This has been fixed and should resolve in the Plugin Directory within the hour.

  6. Is it possible to add default post content?

    Also, does this image uploader resize images to the dimensions specified or is it up to the user to resize before uploading?
    thanks,
    – Shawn

    • Jeff Starr 2011/02/21 4:23 pm

      No option for default post content at this time. Interesting idea though :)

      The plugin lets WordPress do most of the work for image uploads, and will resize images according to your Media Settings. Users can upload any size image you allow, and then WordPress will create resized copies for you.

  7. Howdy. As per Scot, I got the headers message when installing via the dashboard. The plugin does indeed nest itself too deeply. Probably a good idea to get that fixed unless you wanna turn off slightly less tech users.

    • Jeff Starr 2011/02/21 9:05 pm

      Thanks, this should be resolved within the hour (next time WP SVN updates). The current version should contain all files within one /user-submitted-posts/ folder.

  8. Looking good so far, Jeff.

    Have tried image uploading too which has one minor bug on my end. If I select 0 as the minimum number of images to upload and I don’t select any images when using the form I get the following errors:

    Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/fruitbow/public_html/wp-content/plugins/user-submitted-posts/user-submitted-posts.php on line 280

    Warning: Cannot modify header information - headers already sent by (output started at /home/fruitbow/public_html/wp-content/plugins/user-submitted-posts/user-submitted-posts.php:280) in /home/fruitbow/public_html/wp-includes/pluggable.php on line 890

  9. Had a bit more of a play with your plugin and it’s looking pretty solid so far.

    Re: the images: I tried using the post_attachments() function to display all images, but this simply broke an existing posts I had (the site I’m testing it on already has well over 600 posts, alot with images). Perhaps you could tie the following into an option in the plugin settings to automagically show all attached images? (scuse the messy cut and paste)

    add_filter('the_content','ups_show_images',1);
    function ups_show_images($content = '') {
         global $wp_query;
         $thePostID = $wp_query->post->ID;
         $ups_images_output = $content;
         $ups_images = get_post_meta($thePostID,'user_submit_image',false);
         if($ups_images) {
              foreach ($ups_images as $ups_image){
                   $ups_images_output .= "n";
              }
         }
         echo $ups_images_output;
    }

    • Hi @BrenFM where would YOU plug this code in. I’m trying to make it so that the image attachment automatically gets posted everytime.

  10. Hey Jeff, this sounds great, thanks! I had looked for something exactly like this… Photosmash is very similar but recently had it’s support dropped. This seems much simpler and will definitely give it a try. Also – love the DiW book. Thanks again.

  11. Would it be possible for the first image uploaded to automatically become the featured image, ie post thumbnail?

    Thanks

    • Jeff Starr 2011/02/21 9:24 pm

      Great idea! Perhaps in the next version ;)

      • Greg Brazie 2011/02/22 10:30 pm

        Awesome plugin, really liking it so far.

        I second Steve’s idea; automatic featured image would save a lot of time.

        Keep up the good work… great site!

      • IsraelWebDev 2011/02/28 1:51 pm

        Great timing for this plugin!

        I third the “featured image” feature.
        And video would be great too.
        In fact, the whole media and rich-text content editor would be perfect.

  12. Constantin Weber 2011/02/22 11:42 am

    Hi! Great plugin! Thanks for that!
    Is there a way that you display the actual (logged in) user as author without making them type in their name?

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
SAC Pro: Unlimited chats.
Thoughts
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Note to self: encrypting 500 GB of data on my iMac takes around 8 hours.
Getting back into things after a bit of a break. Currently 7° F outside. Chillz.
2024 is going to make 2020 look like a vacation. Prepare accordingly.
First snow of the year :)
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.