WordPress Plugin: 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.
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
- 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
- Install USP just like any other WordPress plugin
- Go to the “User Submitted Posts” settings and customize your options
- 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-submitteduser_submit_image
– URLs of any submitted images (one field per image)user_submit_ip
– the IP address of the submitted-post authoruser_submit_name
– the name of the submitted-post authoruser_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:
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:
- USP submission form (default settings/styles)
- USP Settings page (panels toggled closed)
- USP Settings (full view — panels toggled open)
- Button to filter user-submitted posts
- custom fields included with each submitted post
Download & Demo
To download the free version of User Submitted Posts, visit the plugin homepage at the WordPress.org Plugin Directory.
120 responses to “WordPress Plugin: User Submitted Posts”
Hi Jeff, nice work and it is looking very straightforward for both users and admin.
However, I’m having a similar problem to Josh: the form appears, the post submits, but the image is not uploaded. Also, even though the number of images allowed for upload is set to ‘1’ in the admin, I can merrily add as many as I like on the submit page.
I’m guessing that a successfully uploaded image would be inserted into the post as a thumbnail and would also be available in the wordpress media library?
@stephen I think the images are not automatically inserted into the post until you modify the theme.
The files will be in the media library, and noted as attached to your post.
You can see the image paths in the post’s custom fields.
If your image dimensions exceed your max height/width, the images are not saved, and no notice is given. There should be an error message, and this might the cause of your problem. Not sure if setting to 0 causes pass or fail, but setting max dimensions to a really big number will certainly allow almost all images.
Hi Jeff,
Great plugin, should just about do what I’m wanting it to. Have you put any thought towards enabling this to work with Custom Post Types? Possibly having a text box, or drop down in the admin area to enter one?
Hey Jeff, that worked perfectly!!! Thank you very much. I have one other question, I know there is a ‘redirect’ URL option, is there an element I can put in there that will redirect the user to the post they just uploaded (as I have moderation off)
Thanks again, Jeff!!!
Awesome, great to hear it :)
Currently there is no option for redirecting to the current submitted posts, but it’s a great idea that I will look into for future updates. Thanks for the idea!
This plugin has all the functionality I was looking for for my next project, which is a classifieds webiste.
I have one query though – Is it possible to add extra fields (like location and price in my case) which will then be saved as the post meta so that they can be retrieved from within the loop?
I would be happy to customize your plugin by adding some extra fields. Contact me for more information.
Thanks for the quick reply.
I’m finalising the site so as soon as I’m done so that we work with something that’s already working.
Quick question – Is there another option to purchase your book (Digging Into WordPress) besides using a credit card? I don’t hav a credit card at the moment.
Possibly there is an alternate purchase method.. Send us a quick email at https://perishablepress.com/contact/ and we’ll see what we can do ;)
How can add the post date on the form, I want the user to enter a date and this is published on that date only, it is kind of events that users submit, title, image, text and date of the event … I await your comments.
Hi Jeff, love this plug-in – it is exactly what I needed.
Except, no images are showing up in the new posts. I know the intructions indicate to add this code to the template:
But where would you add it – my theme has code for a SinglePost.php – is that where it goes?
Thanks for your help!
Place the template tag in the loop of any theme template file (such as
page.php
and you should be good to go. Note that there are more than one template tag for the plugin. One displays the form, and another is used to display the images in your loop. See the documentation for more information.Hi Jeff, I have tired getting the images to show up for hours – no luck – please help – where does the template tag code go?
You can include the shortcode into any post or page via the Admin, or you can use the template tag in the loop of any of your theme template files (e.g.,
page.php
).I too have been trying for hours to get the images to show up in 3.1 to no avail, can you tell us in what php file the template tag should go and if anything else is required. I tried upping my image size as was previously stated but it doesn’t seem to be a file size issue. The plugin looks great otherwise, I just really need it to work, any help is greatly appreciated.
Hi Shannon, the template tag should be placed within the WordPress loop in any of your theme template files. I will test further on WordPress 3.1 to see if there are any issues specific to that version.
It turns out my theme had separated out the loop from the theme files so that is why it was not working when I added it to page.php I added it to all four files with loop in the name and now I have photos. Thanks for such a great plugin.
Shannon:
How did you figure this out? I am trying and trying to get images to display. I have tried to add the to my single and page php. But, still cannot get images. I am not experienced with the terms everyone is using as far as loop. So, please help a rookie out. Thanks
Would really like to see the first attached image set as the featured image. I’ve been searching for a front end post plugin that will allow only registered users the ability to post from the front end with the ability to upload a photo to their post and a bonus to be be able to edit their posts. All of the front end post plugins lack one of the two. This is the best plugin so far, yet I don’t like the idea that anyone can post without registering, there will definitely be problems with spam.
Testing it now – works great but what about security? allowing users to send any type of file…
what about allowing users to just send text instead of html?
what about allowing certain html tags?