Allow Users to View only articles they Created

Moderators: mandville, PhilD, General Support Moderators

AnDrej_B
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Feb 18, 2014 2:11 pm

Allow Users to View only articles they Created

Postby AnDrej_B » Fri Apr 14, 2017 8:51 pm

rcarey wrote:You can accomplish this with just a little bit of code.

...

This approach is desirable because you are adding the extra code in a file that is not overriden by upgrades (as long as you override the view file and not hack the original file).

Here are the steps:

[1] Override the view file that displays all the articles. To do this, copy
/components/com_content/views/articles/default.php
and move the copy to this folder:
/templates/<your-template>/html/com_content/articles/default.php
note: If users are to access article through the backend, then you will need to override the the similar file under the administrator folder.

...

[3] Move down to the lines of code in the 120's. You will see a foreach() loop starting, and some permissions variables set. Right after that block of php code, add this code

Code: Select all

<?php
         if(!$canEditOthers && $item->created_by != $userId){
            continue;
         }
?>

...


Hello,

I'd like to setup this on one of my Joomla 3.x sites - however the file "/components/com_content/views/articles/default.php" doesn't exist in Joomla 3 anymore (I guess it's located under "com_content/views/article/tmpl/default.php") and I can't find any "foreach" bit of code in that default.php file...:-/

Is there a way to apply this approach to a Joomla 3 site please?
Last edited by imanickam on Sat Apr 15, 2017 3:00 am, edited 1 time in total.
Reason: Split from the topic https://forum.joomla.org/viewtopic.php?f=673&t=747360 (Joomla! 2.5)

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 26304
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Allow Users to View only articles they Created

Postby imanickam » Sat Apr 15, 2017 4:25 am

The code in the quote you mentioned, refers to a file used in the administration back-end.

Can you please spell out your requirements?

If you are looking for such functionality in the front-end, suggest reviewing the extensions such as User Article Manager (https://extensions.joomla.org/extensions/extension/authoring-a-content/content-submission/article-factory-manager/).

Other similar extensions could be found at https://extensions.joomla.org/category/authoring-a-content/content-submission/.
- Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
http://www.eegan.org - helping the poor and underprivileged
educate. empower. enrich.
Support the poor and underprivileged

AnDrej_B
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Tue Feb 18, 2014 2:11 pm

Re: Allow Users to View only articles they Created

Postby AnDrej_B » Wed Apr 19, 2017 11:41 pm

Hello imanickam,

thanks for your reply.
I checked the links you suggested, but I don't think they're suitable for my issue.

Here's what I'm trying to do:
I want to get the following article setup to work on the Front end on one of my Joomla 3 sites: - Users of the user group A can create, view and edit only their own artile(s) - Users of the user group B can create, view and edit their own article(s) as well as the articles from the user group A.

I checked Joomla 3's ACL tutorial as well, but couldn't find anything usefull for my issue.

I might found a solution for my issue - it seems that an override of a core component will be necessary to achieve this (category.php). I need to test it out first though.

Was just wondering if there isn't any other way how to solve this?

Thanks for any ideas/hints.


Return to “Access Control List (ACL) in Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 1 guest