Joomla – Enabling registered users do add content
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.
Popularity: 100% [?]
Related Entries:








October 24th, 2006 at 4:41 pm
[...] Original post by Vitor Rodrigues. To read the full article visit: Vitor Rodrigues [...]
April 30th, 2007 at 11:17 am
Thanks for the tip!
May 11th, 2007 at 5:37 am
I had a go on my testsite which is on my harddrive. Unfortunately it didn’t work. I still have to login as administrator (I don’t use publishers) to actually publish the article. Perhaps I’ll have more time to try to see what i am doing wrong this weekend. By the way I am using joomla 1.0.12.
May 12th, 2007 at 9:27 am
I’m also using Joomla 1.0.12 and it works fine. I just upgraded to this version a few weeks ago and it was also working in the previous version.
May 20th, 2007 at 12:22 pm
Hi, I have inserted those lines of code to enable registered users to submit content however when I’m logged in as a registered user it’s still telling me that I am not authorised to view that area. Any ideas?
May 20th, 2007 at 12:26 pm
I’ve managed to sort it out now. I needed to change the ‘ ‘ marks.
July 5th, 2007 at 6:34 am
anFjcw kak dumaesh, pomozhet?
August 20th, 2007 at 5:16 am
I just inserted the top line, with the right ‘ ‘ marks, and I get the message that Tom did – You are not authorised to view this resource.
Any ideas what I can do to fix the situation. I only want registered people to be able to submit content, but not have it automatically published (in case its not appropriate)
$this->_mos_add_acl( ‘action’, ‘add’, ‘users’, ‘registered’, ‘content’, ‘all’ );
P.S. I also tried to insert the top two lines, but this made no difference
August 20th, 2007 at 5:18 am
Just solved it. I had also changed the User Menu item ‘Submit content’ to be ‘Special’ meaning I had restrictions on two levels….
By changing it, registered users can now submit content, which is perfect for our community web site.
August 20th, 2007 at 5:47 am
Richard, you can set that in the Administratio Panel. On the content section, you can specify which level of users is authorized to submit content (but not to publish it. That has to be done trough this hack).
The behavior you want is the one I had by default with Joomla.
August 20th, 2007 at 5:51 am
I didn’t see your second message :-/ I guess you solved it like I was explaining
September 21st, 2007 at 11:25 pm
I just tried the hack – simply copied/pasted the text right in there.
It didn’t do a thing, as far as I can tell.
As a registered user, I logged in and submitted news and it didn’t show up on the site. I had to log in as admin and “approve” (publish) it.
Is the hack for an older version of joomla?
September 22nd, 2007 at 4:02 am
hi Bob. make sure you use ‘ and not ` as the single quote. I’ll update the article.
October 24th, 2007 at 4:28 pm
Tried testing this and it worked OK BUT when I logged in as admin couldnt get into the content items to change the author back to admin (me) Now Im locked out, changed the file in include folder back to original still locked out!
Help!
October 24th, 2007 at 9:14 pm
Nick, the locking usually happens when you don’t exit the edit window correctly (by either clicking Save or Cancel). The only way I find to unlock items is to edit the database directly, using phpAdmin.
October 25th, 2007 at 9:29 pm
I tried this.. and it appears to be working.. now I just need to figure out how to allow registered users to add content to any of the sections or categories or just limit to a couple here and there.. seems that I need to add a specific menu item for each section .. i.e. I need to add a menu item for “submit content” and then specify a specific Section… however when I do this, I also tried to select that the add content link it is creating be a child of another user menu item, but it just will not show up.. if I make it a top user menu item it shows up and appears to work just fine…
got any time on saving menu space by having the SUBMIT Content items not all at the top level? I have a few sections, and would like to add many more – but it would be crazy to have 10 submit to this section or submit to that section links on the user menu one after another… theres got to be a better way
October 26th, 2007 at 9:27 pm
I have the same question as bob (September 21st, 2007 at 11:25 pm ) above:
With this code added registered users can add content OK – but they still can’t publish.
Its not to do with quote marks, as I was very careful about that – plus the ability to add content does work. I don’t see how a registered user, with no back end privileges would be able to publish anything. What would they have to do?
Is there an error in your claim that “This will allow registered users to …. and publish their own content. “
October 26th, 2007 at 10:13 pm
Nigel, the claim is true for the joomla website I run, and for all the other people for who this hack worked, as you can see in the rest of the comments.
Please make sure that you also do the “auto publishing” hack, or check the publish checkbox when adding a new entry. Also make sure to check the “show in frontpage” box if that is what you want.
November 14th, 2007 at 2:33 am
You said:
However, if you want a user to be able to create, publish and edit it’s OWN content, it’s not possible
Is not exactly correct, now my site is working correctly after various server issues, a registered user that has been given ‘Author’ status by the admin, CAN edit and publish their own pages., without any modification to the codes.
November 19th, 2007 at 9:07 pm
Thank you, Vitor for the code above! I just plugged it in and it worked like a charm! This will save me so much time going into administration and giving each registered user Author privileges so they can submit content.
December 13th, 2007 at 6:59 am
ok, i am newby – any chance you can explain me how to do this properrly?
January 17th, 2008 at 7:55 am
Hi vitor, I’ve triple checked that the addition of the code to the gacl.class.php file inside the gacl function, but the single quote as per the key ` appears (when editing this file) to actually be ‘ , and it’s exactly the same for all the other entries in that section. So there must be another issue….I was wondering if it could be the acl_count line at the end of the section: ” $this->acl_count = count( $this->acl ); ”
To no avail, the “publishing state” selection box is only available to a publisher. I’m running joomla 1.0.13. I’m trying to give the ‘author’ user publishing permission. Any ideas folks?
February 2nd, 2008 at 5:26 pm
Thank you so much! This was exactly what I needed and I got it to work on my (naescent) story site straight away. You’re a godsend, Victor.
February 16th, 2008 at 7:40 pm
hy. my problem is this.
when i try to change the logo ina my template site, i get a message you do not have permission, critical error and some thing like that
i tried to corect that, now my permisions on that file are 755 but it still get’s the same message???
February 19th, 2008 at 3:42 pm
I can get the ACL set up. But, the Auto Publishing still does not work. I have to go in through the backend as the Publisher to publish the articles.
The checkbox is clicked for Frontpage automatically. But, there’s not a button for “Publish”.
February 19th, 2008 at 8:37 pm
Doesn’t work on my new Joomla 1.1.4
Does anybody know why? The ” are definitively correct.
February 20th, 2008 at 11:45 am
Горнолыжный курорт Красная Поляна – бронирование гостиниц и отелей.
Наши квалифицированные менеджеры подберут вам наиболее подходящий вариант.
http://www.krasnaya-polyana-hotels.ru
February 21st, 2008 at 3:26 pm
http://shop-dvd-films.info/ – интересная и полезная информация на самые популярные темы.
March 24th, 2008 at 2:06 pm
Cheers… is a wonderful hacks, lovely tip
May 5th, 2008 at 4:34 am
Thank you for the tip. Now I can get my members to submit and edit their content hassle free.
Cheers!
June 13th, 2008 at 3:20 am
So Fantastic-ThXXXXXXX
July 17th, 2008 at 12:25 am
In Joomla 1.0.3, there only one line in the file includes/gacl.class.php :
require_once( dirname(__FILE__) .’/../libraries/phpgacl/gacl.php’ );
where to add the above lines?
Is it a different file for this version of joomla.
I am not a programmer, Please someone advise!
July 17th, 2008 at 11:48 am
Try to edit the file .’/../libraries/phpgacl/gacl.php’ and look for similar code . There should be some mos_add_acl calls in there. Hope it helps!
August 12th, 2008 at 5:37 am
hey vitor, great tip, but how to get this to work for joomla 1.5.4 ..?
everyone running 1.0.xx gets it to work, but i cant get it to work with 1.5.4
any ideas..?
thanks.
August 13th, 2008 at 11:17 am
In order to auto publish the files change this in component/com_content/content.php:
content.php
Line 1822 $row->state = 0; to $row->state = 1;
Line 1996 $row->state = 0; to $row->state = 1;
Now it will autopublish and in combination with the original tutorial above users wil auto publish content in all categories..
August 28th, 2008 at 10:58 am
Does this code mod for allowing a reguistered user to publish work on J1.5 Native?
I am not yet having success, but my includes file reads
* Legacy Mode compatibility
* @version $Id: gacl.class.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla.Legacy
I do use any Legacy items… still ok here?
thanks
BR
September 9th, 2008 at 6:43 pm
thanx for the great hack , it works for me on my test site , so going to apply this to my online site soon >
For Joomla! 1.0.15 …. tried this and working fine :
**************************************
1- allow regitered user to submit contents :
open the file includes/gacl.class.php and inside the funciton gacl , meaning after the line contains this code
function gacl( $db=null ) {
search for
$this->acl = array()
add these lines after it :
$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’ );
——————————————
2- In order to auto publish the files change this in component/com_content/content.php:
line 1843: $row->state = 0 –> change it to 1
line 2017: $row->state = 0 –> change it to 1
——————————————
3- To allow publishing on front page change this in component/com_content/content.php:
line 1849: $row->frontpage = 0 –> change it to 1
——————————————
September 23rd, 2008 at 8:56 pm
[...] http://www.vitorrodrigues.com/blog/2006/10/24/joomla-enabling-registered-users-do-add-content/ « Stratego: permainan bagus untuk anak-anak ataupun dewasa [...]
October 17th, 2008 at 9:02 am
Any ideas how to get this done for joomla 1.5.? My only registered users can t even see the article submission page.
Another thing I was wondering about is that from what I have read so far it seemed to me that in joomla 1.0. there was some kind of integrated usermenu that popped up with subitems such as submit news and stuff.
Is that correct and if yes, where did it go in Joomla 1.5.
October 17th, 2008 at 9:05 am
Oh, and something else. Actually: Ideally would be to have a site exactly like ths one i am posting on right now.
It would be exactly what i need to have a blog like function where a user could write a text( like your little tutorial here)
and everyone else could submit comments to it. is that somehow possible to do in joomla?
Thank you for your time
October 17th, 2008 at 12:42 pm
@Dr. Gonzo: yes, you can have a site like this one in Joomla. I am using Wordpress for my site, but you can achieve similar functionality in Joomla. Just enable comments on your articles/news. I believe the comments plugin is already installed by default and only needs to be activated, but I’m not sure.
October 19th, 2008 at 10:15 am
Hey, thanks for the fast help. I managed to get the submission permissions working. The permissions for joomla 1.5. are writen in: \libraries\joomla\user\authorization.php
So for everyone who wants do to this in joomla 1.5., thats how it works: essentially you gotta do the same thing, just slightly different formated. Just add the following lines into //actions( around row 189):
$this->addACL( ‘com_content’, ‘add’, ‘users’, ‘registered’, ‘content’, ‘all’ );
$this->addACL( ‘com_content’, ‘edit’, ‘users’, ‘registered’, ‘content’, ‘own’ );
$this->addACL( ‘com_content’, ‘publish’, ‘users’, ‘registered’, ‘content’, ‘own’ );
October 19th, 2008 at 10:17 am
I have just got one more little problem.
My registered users still can’t see the article submission page.
Do you know who to change the viewing permission for the article submission layout???
Thanks.
October 19th, 2008 at 10:18 am
sorry! who=how obviously.
October 19th, 2008 at 11:49 am
I made the page public (in the menu options, made it visible to public) and when people click in it, the editor will only show up if they are logged in. If the user is not logged in, it will display an error message saying that the user has to login first.
October 30th, 2008 at 7:35 am
iam using joomla 1.5 ….. i added these
$this->addACL( ‘com_content’, ‘add’, ‘users’, ‘registered’, ‘content’, ‘all’ );
$this->addACL( ‘com_content’, ‘edit’, ‘users’, ‘registered’, ‘content’, ‘own’ );
$this->addACL( ‘com_content’, ‘publish’, ‘users’, ‘registered’, ‘content’, ‘own’ );
lines in authorization.php but it is still not working…
pls help me
December 27th, 2008 at 8:54 am
How are you? your website is cool
I have a new band and we just had a live gig you can see here:
http://tinyurl.com/a5sfeo
January 15th, 2009 at 7:05 am
Thanks…
Please what do you use for this commenting system? I need such a response or commenting system for another purpose.
Thank you
March 11th, 2009 at 8:01 am
You are incorrect. “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.” This is wrong. You can specify all new users throught the global configuration. set all new users to be “registered users”.
June 4th, 2009 at 2:10 pm
I have checked the authorization.php and my file already has it in there. I am experiencing this problem.
I have the User auto set to be an Author on start up.
I have the menu items set to be SPECIAL access.
If I login as a user who has Author level, and I manually go to the link that the menu element -Add an Article points to… it says I don’t have access to this page.
My guess is this is a permissions problem on the file server… and that if the server can’t access the right files, it defaults to no access. Help. Any clue.
Am running Joomla 1.5. on PHP5 I’ve heard some place that these features weren’t slated to work till 1.6 is that true? Are they just out there for place holders?
September 6th, 2009 at 11:08 pm
hey totally thanks for the tutorial, I’m looking for this for hours (days). but none give satisfy answer.
I just realize that Author can not publish it self. I wonder why Joomla developer not willing give that things…
superb for the tut,,, I let you know if the tut work… super thx…
December 17th, 2009 at 9:32 pm
Hi.
My PC worked not correctly, too much errors. Please, help me to fix buggs on my computer.
I used Win Vista.
With best regards,
neuragers
December 28th, 2009 at 11:46 pm
Hi!!! How are you?!
Keep your friends updated— even when you’re not signed in.
With everything you do online, updating your friends can be tough. But with Windows Live, you can add web activities so your friends get your updates in one place: the “What’s New” feed. You make online updates, and Windows Live does the rest, A2K4
Buy Cytotec, 8GD0
Buy Tadacip Online, AL90
Generic Pharmacy online, AK62
January 1st, 2010 at 11:26 pm
Looks like you are a true expert. Did you study about the issue? haha
June 2nd, 2010 at 5:48 pm
Thank you for sharing this information. But it really will be actually great to get some a lot more details!
June 10th, 2010 at 11:44 pm
Internet портал http://www.rusiphone4g.info по продаже айфонов, ипадов. Онлайн продажа iPad 64 GB Wi-Fi + 3G за 52000 р. Описание и характеристики.. У нас всегда есть в наличии Iphone 4G & iPad 64 3G+WiFi. Доставка по Москве. Контактная информация.
June 20th, 2010 at 10:00 pm
The herbal products from weightloss168.com prevent the digestion of dietary fat, hence reducing its absorption by the body after sometime of consumption. Visit weightloss168.com to find the weight loss product suitable for you.
July 30th, 2010 at 4:53 pm
Hi guys!
Could you look on my website, please?
meble drewniane
You can formulate up also english interpretation there or
sypialnie
August 23rd, 2010 at 4:59 pm
Nice informative site, keep it up