User-Submitted Content - how to allow your users to upload content to your site
Date: 23-11-2007 14:09 Views: 9191
If you want to accept content from your visitors, but don't want them having access to your admin area, MonkeyCMS allows you to set up submission forms to allow any user to upload content to your site. You don't have to worry about it being inappropriate as each and every piece of submitted content will appear in the schedule allowing you to approve everything before it appears online.
The default MonkeyCMS install includes the SubmitNews template. This is the most basic of options available to you and simply allows any user to submit content to a fixed definition. Below is a screenshot of the default SubmitNews template:

As you can see, there are two options available to your users - Content Title and Content. You can in fact accept input to any content element for your chosen definition and this will be explored later in the tutorial.
Basic Configuration Options
Before accepting user news submissions, there are a couple of settings in the Site Settings area (Site > Site Admin > Site Settings) that need to be checked and configured to your requirements.

Overriding the 'User News Definition' Option
You may want to override the default definition for content uploads - this may be because you want to accept uploads for multiple definitions and therefore have a separate form page for each.
All you need to do is add a hidden field to your submission form with the 'name' of 'definitionid' and the value set to the numeric ID for the definition you wish to upload to.
The example below shows the modified form accepting uploads to definition id 3:

Successful Submission Message
The default message for successful content submissions is submitcontent:submitted, however you can choose to override this to support alternative messages for each type of submission.
All you need to enter is a hidden field named 'successmessage' with the value of whatever message name you have created.

Accepting Additional Content Elements
At present MonkeyCMS (up to at least version 1.1.3) allows you to accept content submissions for 'String' and 'Content' elements. It does not support any of the drop-down lists or other content types.
You can also accept the default elements of 'headline' (which correlates to title), 'news' (correlates to content_longtext), 'miscstring1', 'miscstring2', 'miscint' and 'miscfloat'.
Future versions of MonkeyCMS will expand on content element options and this tutorial will be updated to include any improvements made to the software as and when they happen. If this is an area of interest to you and you are registered and logged in, it may be worth subscribing to updates to this content by selecting the checkbox in the left hand column of the page.
Any of the standard elements (including miscstring1 through to miscfloat) can be included as basic text form elements with no additional configuration. However, to accept other elements you must also include a hidden field name 'additionalfields' with a pipe-separated (|) list of additional fields to accept - this is to let MonkeyCMS know to look for the data submitted for these elements. The names of these fields must correspond to the labels you have assigned to them in the definition create/edit screen.
The screengrab below shows a form configured to accept additional inputs of 'miscstring1' (as a URL) and a custom elements of 'Telephone Number' and 'Address':

The resultant form looks like this:

Summing Up
Accepting news from users is always a useful addition to any community driven website. However, you should remember that original content is what brings visitors back and you should also be very careful that your visitors aren't uploading content that someone else holds the copyright on. If they do, you could end up in a lot of trouble!
Be vigilant and try to avoid upsetting other sites and accepting user content can give your site a real edge over the competition.
The default MonkeyCMS install includes the SubmitNews template. This is the most basic of options available to you and simply allows any user to submit content to a fixed definition. Below is a screenshot of the default SubmitNews template:
As you can see, there are two options available to your users - Content Title and Content. You can in fact accept input to any content element for your chosen definition and this will be explored later in the tutorial.
Basic Configuration Options
Before accepting user news submissions, there are a couple of settings in the Site Settings area (Site > Site Admin > Site Settings) that need to be checked and configured to your requirements.
- User News Definition is the default definition for content submissions - this can be overriden in the submission form if necessary
- Allow Anonymous Content Submissions - if you don't want to force users to register before they can submit content, you can set this to Yes. However, this is not recommended and may attract spammers causing you a lot of work sifting through your submissions
- Anonymous Content User Account - if you are accepting anonymous submissions, this is the user account they will be saved against. You could set this to your account, or you could create an Admin user account specifically for these submissions. You can also store them against the SYSTEM account if you so wish.
Overriding the 'User News Definition' Option
You may want to override the default definition for content uploads - this may be because you want to accept uploads for multiple definitions and therefore have a separate form page for each.
All you need to do is add a hidden field to your submission form with the 'name' of 'definitionid' and the value set to the numeric ID for the definition you wish to upload to.
The example below shows the modified form accepting uploads to definition id 3:
Successful Submission Message
The default message for successful content submissions is submitcontent:submitted, however you can choose to override this to support alternative messages for each type of submission.
All you need to enter is a hidden field named 'successmessage' with the value of whatever message name you have created.
Accepting Additional Content Elements
At present MonkeyCMS (up to at least version 1.1.3) allows you to accept content submissions for 'String' and 'Content' elements. It does not support any of the drop-down lists or other content types.
You can also accept the default elements of 'headline' (which correlates to title), 'news' (correlates to content_longtext), 'miscstring1', 'miscstring2', 'miscint' and 'miscfloat'.
Future versions of MonkeyCMS will expand on content element options and this tutorial will be updated to include any improvements made to the software as and when they happen. If this is an area of interest to you and you are registered and logged in, it may be worth subscribing to updates to this content by selecting the checkbox in the left hand column of the page.
Any of the standard elements (including miscstring1 through to miscfloat) can be included as basic text form elements with no additional configuration. However, to accept other elements you must also include a hidden field name 'additionalfields' with a pipe-separated (|) list of additional fields to accept - this is to let MonkeyCMS know to look for the data submitted for these elements. The names of these fields must correspond to the labels you have assigned to them in the definition create/edit screen.
The screengrab below shows a form configured to accept additional inputs of 'miscstring1' (as a URL) and a custom elements of 'Telephone Number' and 'Address':
The resultant form looks like this:
Summing Up
Accepting news from users is always a useful addition to any community driven website. However, you should remember that original content is what brings visitors back and you should also be very careful that your visitors aren't uploading content that someone else holds the copyright on. If they do, you could end up in a lot of trouble!
Be vigilant and try to avoid upsetting other sites and accepting user content can give your site a real edge over the competition.

