Sometimes, I would like to restrict the way the Joomla front end editing works. More specifically, I want to restrict access to some of the features in the front end editing.
On one site I work on, I've restricted access to the 'Publish' and 'Show on Front Page' buttons. For this particular site, I want local editors of an organization to be able to enter new articles, and to edit the published articles. I don't want the local editors to be able to publish to the front page. This is something the editor-in-chief should do. Thus, this function needs to be removed from the front end editor.
I did this by editing the form page used to edit articles.
If you know some HTML and can read PHP you can remove / comment out the parts of the file you don't want the users to see. This will happen for all users without administrator privileges, though. I've put together a modification which removes the radio buttons for 'Publish' and 'Show on Front Page' if the user belongs to a lower access level groups than 'Manager'.
To accomplish this you will need to do a template override. I suggest you read my blog post about Joomla template overrides if you are unfamiliar with the concept.
Joomla template overrides to the resque
The file you need to modify is:
/templates/YOURTEMPLATE/html/com_content/article/form.php
If the file doesn't exist in your template html folder, you need to copy it from the Joomla core folder, namely:
/components/com_content/views/article/tmpl/form.php
In this file, you will find the following code (I've added some whitespace to make it easier to read):
<tr>
<td class="key">
<label for="state">
:
</td>
</tr>
<tr>
<td width="120" class="key">
<label for="frontpage">
:
In front of this code, enter this:
after the code, you enter:
These are PHP code snippets which will show the labels and radio buttons for the 'Publish' and 'Show on Front Page' functions only of the user has the required access level (Manager or above).
Which means you end up with a section in your file looking like this:
<tr>
<td class="key">
<label for="state">
:
</td>
</tr>
<tr>
<td width="120" class="key">
<label for="frontpage">
<?php echo JText::_( 'Show on Front Page' ); ?>:
</label>
</td>
<td>
<?php echo $this->lists['frontpage']; ?>
</td>
</tr>
<?php endif; ?>
The result
This is what (part of) the front end editor looked like before the template override:
and this is how it looks without publishing and show on front page capabilities:
Opens lots of possibilities
Use this function to restrict other parts of the edit form as well. You can modify the edit form as you please by using the template override.
Move the settings above the text area, move the button to the end of the form (makes sense, doesn't it?) or perform any other modifications you might want using Joomla template overrides.
Have any other ideas on how to modify the front end editing in Joomla?
Let us know in the comments below!