Objects Unlocking and Checkin in Joomla
This article is devoted to unlocking of Joomla site obejcts; it covers such areas as editing of locked articles, ContentUnlocker module (which is for unblocking of data), unlocking of objects by Manager and Administrator.
How to edit locked article
The beginners of Joomla often have a problem that can’t edit their articles in the administrator’s pane because the articles are locked. This is not the problem at all, and I will tell you what you should do to unlock the article here.
Joomla is a multiuser system. Therefore content unit is locked at the moment of its editing. This is to prevent editing of the article by other users at the same moment.
Article is unlocked automatically when saving, or clicking Close/Cancel button in the editing dialog window. But sometimes users forget save article or click Close/Cancel and the article is left locked.
You should perform the following steps to unlock site content:
- Enter to the adminsitrator’s panel;
- Select System> Global Checkin
- All locked content of the site is unlocked now.
Note: you can unlock other Joomla elements: modules, menu elements, elements of some components (for example, banners) in the same way.
Content Unlocker
When editing of some data in Joomla-based site, Authors often forget to click Save (or the data is not saved because of JavaScript error). As a result – the data is locked. Meanwhile users of Administrator or Manager groups cannot unlock the data by themselves. If the data should be edited in a short time, they should ask to unlock it users from Super administrator group. ContentUnlocker module was developed to automate this process.
Module works in a very simple way: specify identifier of the data that is to be unlocked in the module form and click GO.
You can list identifiers of users who will be permitted to the module in ContentUnlocker settings through the front-end of the site. The default identifier is 62 – ID of super administrator.
How Manager and Administrator Can Unlock Site Content
By default, unlocking is available for users from Super Administrator group only. But users with Manager rights often create content of the site. So locking of some content unit becomes a problem – Manager should ask Super Administrator to unlock an article. ContentUnlocker module is one of the ways to fix this problem. But there is another one. In this section I would tell you how to access unlocking for all users of the administrative panel with the help of a little modification.
I recommend you to backup files to be changed before you start. Backup will allow you to undo your changes and repair you site in the case of some problems.
Then do:
- Open ../administrator/components/com_checkin/admin.checkin.php file;
- Find the following code there:
if (!$acl->acl_check( ‘administration’, ‘config’, ‘users’, $my->usertype )) { mosRedirect( ‘index2.php?’, _NOT_AUTH );
and replace it with/* if (!$acl->acl_check( ‘administration’, ‘config’, ‘users’, $my->usertype )) { mosRedirect( ‘index2.php?’, _NOT_AUTH );} */
- Save your changes;
- Open ../administrator/modules/mod_fullmenu.php file;
- Find the following code there:
}?> _cmSplit,
// Help Sub-Menu - And change it to:
} else {
?>
_cmSplit,
[null,’System’,null,null,’System Management’,
[‘<img src="../includes/js/ThemeOffice/checkin.png" />’, ‘Global Checkin’, ‘index2.php?option=com_checkin’, null,’Check-in all checked-out items’],
],
<?php
}
?>
_cmSplit,
<?php
// Help Sub-Menu - Done!
How to unlock Joomla objects
Earlier I told about some of the methods to unlock Joomla objects. But there is a comprehensive solution – disable the proper objects locking. This solution can be applied only for those sites which have a small number of administrators (1-2), i.e. where probability of simultaneous editing of some object those sites which content almost is low.
To represent an object in database Joomla uses descendant of the base Joomla class mosDBTable which contains methods for locking (checkout) and unlocking (checkin) of objects. Therefore if you’ll disable logic of these functions in the mosDBTable class, locking of objects will not work (except when developers of additional extensions use their own implementation of these objects which is a very seldom thing).
Before begin your modification, I recommend backup the files to be changed. Backup will allow you to undo your changes and repair you site in the case of some problems.
Let’s start!
- Open ../includes/database.php file
- Fine the following code there
function checkout( $user_id, $oid=null ) {
and replace it with
function checkout( $user_id, $oid=null ) {
return true;
- Fin the following code there
function checkin( $oid=null ) {
and replace it to
function checkin( $oid=null ) {
return true;
- Save your changes.
That is all! Now you task is just to choose which unlocking method you’ll use (if you which to use it).