Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
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 = Web Developer. Security Specialist. WordPress Buff.
SAC Pro: Unlimited chats.

120 responses to “WordPress Plugin: User Submitted Posts”

  1. can you put some wysiwyg editor in this plugin?

    is it posible to have a standard wordpress media upload button for this plugin?

  2. How do you display in a post the URL that the user inputs?

    Thank you!!!

  3. My user uploaded photos go to the page with the shortcode and not the post itself. Anybody have any ideas about that? I will insert it into the post but would like it to be attached the the post so I don’t have to look for it.

  4. I can’t seem to get images to automatically get posted. Is this common? What could I be doing wrong?

  5. Jeff,
    I have just the Name, URL & IMage upload fields enabled with the maximum img dimensions set to 800×800 & limit set from minimum = 1 to max = 2.
    However on submission, i get an error, i.e. no error message but the redirected URL reads ?submission-error=1. Are there are directory permissions I need to modify?
    Any insights/suggestions are appreciated.
    Thanks.

  6. great plugin thanks! one thing – how to set up redirect to submitted/published post (if it’s auto-approved)? Is this possible at all?

  7. huh, just found it. All I need is this string
    $redirect = get_permalink($publicSubmission);

    before this part of code

    $redirect = add_query_arg(array(‘success’=>1), $redirect);
    wp_redirect($redirect);
    exit();

  8. Amanda Wolfe 2011/04/11 6:05 am

    Hi there! Great plugin–thank you! I need to be able to capture email addresses of users who submit posts (just like a comment form, I’d like to make that required). I thought about just changing the label on the URL field but I’d rather do it the “right” way if that exists. (Is this functionality that you may be planning to include on a future version? If not, any suggestions on how to accomplish?) Thanks so much!

  9. Awesome plugin does everything I need and more. One question, any idea how to make the authors of these user submitted posts searchable within the site, currently when you click the authors name you just get a 404 error. I have lots of users posting on many occasions and I’d like to see see all that authors content pop up. Just thought I’d ask. Thanks again for this plugin!

  10. Great plugin, exactly what I needed. Works good with the exception of a few things:

    If you click the “add another image” button and don’t actually add an image, it returns an error.

    Category names with an ampersand in them are not displayed properly in the dropdown menu.

    That being said, requests like min are the exact reason I am afraid to publish a plugin. “Hey… love this plugin but fix this and add this…..”

    Add this to the wish list. I’d like to be able to add a couple extra fields to the form, and designate some fields as “required.”

    But hey man, thanks for this. I’m going to deploy it almost as is, and as soon as I get a positive balance in that Paypal account I’m gong to fork over for the book. Good site.

  11. I was having the same problem as Jason – Zero images set as minimum, but error message if you don’t upload an image. His fixe worked for me too, thanks Jason.

  12. Hi Jeff,
    Total newbie here but where do I put code? Do you have an example or two?

    Thanks,

    fnb

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 »
Wizard’s SQL for WordPress: Over 300+ recipes! Check the Demo »
Thoughts
I disabled AI in Google search results. It was making me lazy.
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources. Also: “The Web” is not a valid answer.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.