3

I went to edit my site's articles and modules, where I saw some items having a padlock next to their titles.
When I click on these items to edit them, I am getting the following error:

Error
Check-out failed with the following error: The user checking out does not match the user who checked out the item.
You are not permitted to use that link to directly access that page (#145).

Why my articles are locked and how to unlock them ?

6

1. What does this padlock mean:

Joomla Core Components like content (articles), categories, menu, modules, extensions, etc, contain in their database table structure a field called "Checked-Out", which can take 2 values: "0" for Checked-In status, or the actual user ID for Checked-Out status.

When any user is editing a specific item e.g. an article, Joomla's system changes this item's "Checked-Out" value from 0 to the this user's ID, which means that the item is currently in "Checked-Out" status.

The item will revert back to its "Checked-In" status (Checked_Out = 0), when the user clicks on the "Save" or "Close" buttons of the item.

During the Checked-In status, Joomla displays this Padlock icon next to the item's title in the items list, to indicate that the item is currently being edited by a user.

Furthermore, Joomla won't allow any other user to access the same item simultaneously.

This is to prevent undesired results and confusion in the backend, as if more than 1 user would be able to edit the same item at the same item, only the changes of the last user that would click the "Save" button would take place.

An interesting side note here:
A padlock may appear even when no other admin user is logged in, or even when the site has only 1 administrator.
As said an item will enter in Checked-Out status, when being in Editing mode. The status will only revert back to Checked-In, when the user click on the Save or Close button.

These buttons are triggering the functions to update the database. If for any reason the user leave the editing mode of this item, without clicking those buttons, then the item will continue to have the value of the User ID for the Checked_Out field in the database, which will make Joomla believe that this item is still under editing mode.

2. How to unlock the item.

Usually in multi-user environments, you will want to wait for the other user to complete his work on this item. It's recommended to contact him and ask him about the status of his work.
You can find who is the user that edits the item, by hovering with your mouse over the padlock, and a tooltip with the relevant info will appear.

To unlock the item, you need to have backend administration access and the required permissions to access the Checked-In functionality.

  • 1 Item Check-In
    In the back-end administration items list (e.g. articles list), you can either click on the padlock icon to unlock that specific item.

  • Multiple Items Check-In of the same List
    If there are more than 1 locked items that you want to unlock in the list, you can tick their checkbox and then click the Check-In button, on the toolbar.

  • Global Database Check-In
    Finally there is a Global Check-In, under "System" Menu, where you can Checked-In all database tables that supports the Checked-Out feature at once.
    Be aware though, that this should be used with caution, especially in multi-users sites, to avoid any issues/confusions as described above.

  • 3
    Good answer. Side note: checked_out value is either 0 or the id of user who is editing the content. Also this feature can be implemented in custom components. – Farahmand Nov 13 '14 at 15:25
  • Yes you are right, it holds the userid - my mistake, I will correct the answer. – FFrewin Nov 13 '14 at 16:08
0

I builded a component that can be edited by multiple users. The edit method from JControllerForm look for this property like this:

// Get the previous record id (if any) and the current record id.
$recordId = (int) (count($cid) ? $cid[0] : $this->input->getInt($urlVar));
$checkin = property_exists($table, 'checked_out'); // <---

// ....

// Attempt to check-out the new record for editing and redirect.
if ($checkin && !$model->checkout($recordId)) // <---
{
    // Check-out failed, display a notice but allow the user to see the record.
    $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKOUT_FAILED', $model->getError()));
    $this->setMessage($this->getError(), 'error');
    // ....
}

So an easy way to avoid this functionality is just to remove the checked_out field from the related table so $checkin is always FALSE


Note: This is not a suggestion to modify the Joomla code or any related database. I came here looking for info about Joomla cheking feature. This solution is suitable to develop multiuser components, ie, to be edited by multiple users.

  • This can be considered only if you create your own component where you can simply just develop it without this functionality. Otherwise it's not wise to suggest this for components that already have this feature - and actually this is something useful and has its purpose. – FFrewin Nov 20 '14 at 20:58
  • @ffrewin happy now? :) – Igor Parra Nov 20 '14 at 23:13
  • @IgorParra - I'm struggling to see how this is a good idea. Having multiple users edit something in the backend can result in a loss of data from 1 of the users. This is why the checkout feature was added, so why would removing it be a good idea? – Lodder Feb 8 '15 at 3:25
  • @lodder Again: This is not a suggestion to modify the Joomla code or any related database.... This solution is suitable to develop multiuser components, ie, to be edited by multiple users. And I never said that it should be removed. – Igor Parra Feb 8 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.