FAQs for User Submitted Posts

This post contains overflow FAQs for the free version of User Submitted Posts (hosted at WordPress.org). I am moving a bunch of the FAQs to this post in order to clean up the plugin’s ever-growing readme.txt file. For FAQs about the Pro version of USP, check out USP Pro – FAQs & Presales over at Plugin Planet. And so without further ado..

Note that these FAQs are in no particular order..

Is it possible to set up conditional redirects?

I haven’t tried it myself, but it might be possible. In the form code, there is a hidden input that specifies the redirect URL. The hidden input has a name attribute with a value of redirect-override. So you could target this input with some JavaScript, and then change the value of the hidden field based on whatever criteria you need.

What is the plugin setting for the “From” email header?

That setting enables you to customize the address used as the “From” header for email messages. If your email address is a domain-based address, then this setting should be the same as the previous Email setting. Otherwise, if you are using a 3rd-party email service, this setting should be a local, domain-based address. If you find that email messages are getting sent to the spam bin, this setting may help.

How can I display the form again after the user has successfully submitted a post?

Follow the steps to create a custom form, but use submission-form-alt.php instead of submission-form.php. Note the alternate form template still needs a way to clear cookies after successful form submission, so not recommended for public sites.

Does USP require the functions exec(), exec.php, or url_fopen?

Nope. User Submitted Posts does not use any of those functions.

Why doesn’t the USP shortcode work when added to the WP Text widget?

By default, WordPress does not enable shortcodes in widgets. I have added a plugin setting called “Enable Shortcodes” that will enable any/all shortcodes to work in widgets. Enable that setting and you should be good to go.

Note: the “Enable Shortcodes” setting applies to all shortcodes, even those of other plugins. Check out WP-Mix for more information on enabling shortcodes in widgets.

My form has lots of extra spacing between each field, how to fix?

There are numerous reasons why a form might be displayed with too much spacing between the fields. Here are some possible things to look at:

  • The USP shortcode may be wrapped with <code> tags; solution: remove the code tags.
  • Theme CSS may be interfering with its own styles; solution: examine theme styles and edit as needed.
  • There may be interference from some other plugin/theme; solution: troubleshoot your plugins and themes (check out the sections on troubleshooting plugins and themes).

The Name and URL fields are not displayed in the form, even though they are set to display in the plugin options.

The setting “Registered Username” when enabled will automatically hide the Name field. Likewise the setting “User Profile URL” when enabled will automatically hide the URL field. Try enabling these settings, logging out of WordPress, and then refreshing the form page.

How do I display success and error messages when the “Redirect URL” setting is enabled?

Add the following template tag in your theme template, wherever you want to display the success/error messages:

<?php echo usp_redirect_message(); ?>

You can then style the output via the following selectors:

.usp-error {}
#usp-error-message {}
#usp-success-message {}

Check out more CSS hooks for User Submitted Posts.

Nothing happens when you click on the “Add another image” link.

The “Add another image” link is dependent on the required JavaScript being included in the page. Check the plugin setting to “Include JavaScript?” and you should be good to go. Also make sure that the “Image Uploads” settings are configured to allow multiple files.

The height of my form fields are all messed up, how to fix?

USP provides its own, very minimal styles. Nothing that sets the height for any form fields. So if your field heights look weird, most likely your theme or a plugin is adding its own CSS styles. To resolve, you can try adding this bit of CSS to your stylesheet:

#usp_form .usp-input, #usp_form .usp-select, #usp_form .usp-textarea, #usp_form .usp-submit { height: initial; }

That line basically resets the height property of all form fields to the original value. So it should override any other height styles.

How can I customize the login-required message?

When the setting “Require User Login” is enabled, and the user is not logged in, they will see a message that says, “Please log in to submit content!”. To customize this, add the following code to your theme’s functions.php file:

function usp_customize_login_required_message($message) {
	return '<p>Please <a href="http://example.com/wp-login.php">register</a> to submit content.</p>';
}
add_filter('usp_require_login', 'usp_customize_login_required_message');

Then customize the return line however is desired. This trick uses USP’s filter hook, usp_require_login.

How can I change the default Post Title?

When the Post Title field is not included in the submission form, USP automatically uses the default: “User Submitted Post”. To customize the default Post Title, you can use the provided USP filter hook, usp_default_title. Here is an example:

function usp_customize_default_title($title, $time) {
	return $title .' - '. $time;
}
add_filter('usp_default_title', 'usp_customize_default_title', 10, 2);

That will append a unique date/time string to the default Post Title.

I’m new to WordPress and just installed USP. How do I display the form?

To add the form via shortcode, you can visit the Post or Page on which you would like to display the form, and then paste the shortcode into place. Remember to save your changes.

To add the form via template tag, it really depends on the theme, because each theme tends to use template files differently. It also depends on where on the page you would like to display the form, for example the sidebar (sidebar.php), the footer (footer.php), and so forth. Also, chances are that you’ll need to add the form to more than one template file, for example index.php and page.php, etc. A good first place to try would be the sidebar, or maybe index.php and then go from there.

How do I display the submitted Author Name and Author URL instead of the Default Assigned Author?

This functionality is built in to the Pro version of USP, but it’s also possible using either of the following methods:

  • Replace your theme’s current author tags with USP’s usp_author_link()
  • Add some custom code to your theme’s functions.php file. If interested, please contact me directly, and I will send the code and steps to implement.

I need help doing basic troubleshooting, can you provide any resources?

Yes, check out these tutorials:

For troubleshooting plugins and themes, check out the first tutorial sections on “Plugins” and “Themes”.

More FAQs & Infos

For more USP FAQs (for the free version of the plugin), visit the User Submitted Posts homepage at WordPress.org. For FAQs about the Pro version of USP, check out USP Pro – FAQs & Presales over at Plugin Planet.

Questions? Feedback?

Send any questions or feedback via my contact form, and I’ll get back to you asap. Thanks! :)