Enabling registered users do add content

by hawarihadi

Although Joomla is one of the most advance CMS available, there are some things that I really don’t like/agree with. One of these things is the complex Access Control List. There are too many different user types and registered users have no permission to add content to the site. They need to be upgraded from “Registered” to “Author”. Still, and Author can only create content, but not publish it. Only a Publisher can publish content. And between Author and Publisher there is still the Editor, that can create and edit content, but can’t publish. As you can see, there are too many different user types (and I forgot to mention the Manager and Administrator types also availabel for the frontend. On the backend, another long list exhists).


If this complex organization was not enough, you cannot specify a default user type, so everybody that registers becomes a “Registered User”, without permissions to add content. The Joomla solution is to go to the administration backend  and switch the user to the group you think it fits (one of the listed above). However, if you want a user to be able to create, publish and edit it’s OWN content, it’s not possible rigth now. Registered users can only create content and Publishers can publish content from all users, so none of this types is good for our needs. After reading on foruns about the Joomla ACL (that was inherited just like it is now from Mambo) and about the no-will of Joomla developers to listen to community and change it, the only solution is to change the source code yourself. A very easy solution indeed. Just open the file includes/gacl.class.php and inside the funciton gacl add the lines:


$this->_mos_add_acl( ‘action’, ‘add’, ‘users’, ‘registered’, ‘content’, ‘all’ );

$this->_mos_add_acl( ‘action’, ‘edit’, ‘users’, ‘registered’, ‘content’, ‘own’ );

$this->_mos_add_acl( ‘action’, ‘publish’, ‘users’, ‘registered’, ‘content’, ‘own’ );



This will allow registered users to add any type of content, edit their own content and publish their own content. The same logic applies to other user types in case you want to change any of the permissions on the file.


Auto Publishing


Another sometimes useful feature not available in Joomla is the frontpage auto-publish of content (the Publisher is the one that decides to put the content in the frontpage or not when he publishes it). This can be achieved with a single change in the file components/com_content/content.php. Search for the line:


$row->frontpage         = 0;


and replace it with:


$row->frontpage         = 1;


This will enable frontpage auto-publishing of all your contents. Note: although this may be useful for publishing news in the frontpage, it may not be what you want for when you create articles that are not to display in the frontpage (In this case, you need to uncheck the frontpage publishing box). You should consider wich one is the most common case and decide on the best option for it.