Easily submit posts and images from the front-end of your site.
To display the submission form on any WP Post or Page, add the USP Shortcode:
Or, to display the form anywhere in your theme, add the USP Template Tag:
<?php if (function_exists('user_submitted_posts')) user_submitted_posts(); ?>
Customizing the form
There are three main ways of customizing the form:
Filters: usp_post_status usp_post_author usp_form_shortcode usp_mail_subject usp_mail_message usp_new_post usp_input_validate usp_require_login usp_default_title Actions: usp_submit_success usp_submit_error usp_insert_before usp_insert_after usp_files_before usp_files_after
Check out the complete list of action hooks for User Submitted Posts
More info about WordPress Actions and Filters
Custom Submission Form
Out of the box, User Submitted Posts provides a highly configurable submission form. Simply visit the plugin settings to control which fields are displayed, set the Challenge Question, configure submitted images, and much more.
There are situations, however, where advanced form configuration may be required. In order to allow for this, USP makes it possible to create a custom submission form. Here are the steps:
First, copy these two plugin files:
Then, paste those two files into a directory named
/usp/ in your theme:
Lastly, visit the plugin settings and change "Form style" to "Custom Form + CSS". You now may customize the two files as desired; they will not be overwritten when the plugin is updated.
Alternately, you can set the option "Form style" to "HTML5 Form + Disable CSS" to use the default USP form along with your own CSS. FYI: here is a list of USP CSS selectors.
Or, to go further with unlimited custom forms, check out USP Pro :)
Displaying submitted posts
User-submitted posts are handled by WordPress as regular Posts. So they are displayed along with other posts according to your WP Theme. Additionally, each submitted post includes a set of Custom Fields that include the following information:
is_submission- indicates that the post is a user-submitted post
user_submit_image- the URL of the submitted image (one custom 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
There are numerous ways to display these Custom Fields. The easiest way is to visit the plugin settings and configure the options available under "Auto-Display Content". There you can enable auto-display of submitted email address, URL, and images. Note that submitted images also are uploaded to the WP Media Library.
For more flexibility, you can use a variety of WP Template Tags (e.g., get_post_meta()) to display Custom Fields. Here are some tutorials for more information:
And here are some tutorials that may help with custom display of submitted images:
Also, here is a Helper Plugin to display Custom Fields. It originally is designed for use with USP Pro, but also works great with the free version of USP.
Auto Display Images
To automatically display submitted images on the frontend, visit the plugin settings, "Images Auto-Display" and select whether to display the images before or after post content. Save changes.
To set submitted images as Featured Images (aka Post Thumbnails) for submitted posts, visit the plugin settings, "Image Uploads" and check the box to enable "Featured Image". Save changes.
User Submitted Posts includes two shortcodes:
[user-submitted-posts]- displays the USP form on any Post or Page
[usp_display_posts]- displays a list of all user-submitted posts
[user-submitted-posts] shortcode does not have any attributes. You simply include it wherever you want to display the form.
[usp_display_posts] shortcode has two optional attributes, "userid" and "numposts". Examples:
[usp_display_posts userid="1"]: displays all submitted posts by registered user with ID = 1
[usp_display_posts userid="Pat Smith"]: displays all submitted posts by author name "Pat Smith"
[usp_display_posts userid="all"]: displays all submitted posts by all users/authors
[usp_display_posts userid="all" numposts="5"]: limit to 5 posts
[usp_display_posts] displays all submitted posts by all authors. So the attributes can be used to customize as desired.
USP also includes a set of template tags for customizing and displaying submitted posts:
/* Display the USP Form Usage: <?php if (function_exists('user_submitted_posts')) user_submitted_posts(); ?> */ user_submitted_posts() /* Check if post is a submitted post Returns true or false Usage: <?php if (usp_is_public_submission()) return true; ?> */ usp_is_public_submission() /* Get all image URLs Returns an array of image URLs that are attached to the current submitted post Usage: <?php $images = usp_get_post_images(); foreach ($images as $image) echo $image; ?> */ usp_get_post_images() /* Display all images Outputs a set of <img> tags for images attached to the current submitted post Usage: <?php usp_post_attachments($size, $beforeUrl, $afterUrl, $numberImages, $postId); ?> Parameters: $size = image size: thumbnail, medium, large or full -> default = full $beforeUrl = text/markup displayed before each image URL -> default = <img src=" $afterUrl = text/markup displayed after each image URL -> default = " /> $numberImages = number of images to display for each post -> default = false (display all) $postId = an optional post ID to use -> default = uses global post */ usp_post_attachments() /* Display submitted author name and URL This tag displays one of the following: - The author's submitted name as a link (if both 'User Name' and 'User URL' fields are included in the form) - The author's submitted name as plain text (if 'User Name' is included in the form, but 'User URL' is not included) - The author's registered username as a link to the author's post archive (if 'User Name' is not included in the form) Usage: <?php usp_author_link(); ?> */ usp_author_link()
These template tags should work out of the box when included in your theme template file(s). Keep in mind that for some of the tags to work, there must be some existing submitted posts and/or images available.
The source code for these tags is located in
To upgrade User Submitted Posts, remove the old version and replace with the new version. Or just click "Update" from the Plugins screen and let WordPress do it for you automatically.
Note: uninstalling the plugin from the WP Plugins screen results in the removal of all settings from the WP database. Submitted posts are NOT removed if you deactivate the plugin, reset default options, or uninstall the plugins; that is, all submitted posts must be removed manually.
Restore Default Options
To restore default plugin options, either uninstall/reinstall the plugin, or visit the plugin settings > Restore Default Options.
User Submitted Posts cleans up after itself. All plugin settings will be removed from your database when the plugin is uninstalled via the Plugins screen. Submitted posts are NOT removed if you deactivate the plugin, reset default options, or uninstall the plugins; that is, all submitted posts must be removed manually.
Pro version of USP now available! USP Pro includes many more awesome features and settings, with unlimited custom forms, infinite custom fields, multimedia file uploads, and much, much more.
Requires: 4.1 or higher
Compatible up to: 4.7.1
Last Updated: 2 months ago
Active Installs: 20,000+
8 of 30 support threads in the last two months have been marked resolved.
Got something to say? Need help?