- Posts: 130
COMMUNITY FORUM
Author can't view his own unpublished item
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
I can't find a setting where I can grant a user view-access to all their own articles. Am I missing something? Or do I need to hack the source of com_k2 > views > item > view.html.php (which is generally not a good idea.)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
You have to wait for v3 which brings the entire administrator area to the frontend.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
I hardly dare to ask: any news on the V3 release?
Please Log in or Create an account to join the conversation.
- Ioannis Toutoulis
-
- Offline
- New Member
- Posts: 8
Steven Trooster wrote: Ok, thank you.
I hardly dare to ask: any news on the V3 release?
I had a similar problem so i created a module to solve (not completely) this problem for my authors. Basically this module brings a number of K2 articles and shows in a table the title, category, published date, author, access level, if it is published, unpublished or pending and an edit button.
Still you are not able to see unpublished or pending articles but you can edit them through K2's classic modal window. You can give it a try and see if that works for you. There are one or two parameters in this module so check them out before publishing it.
PS: I upload it to wetransfer so it will only be kept there for 7 days.
we.tl/KBiZvv7RUE
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Sindre Westre
-
- Offline
- New Member
- Posts: 3
I'd like to install the module you created. Would it be possible to upload it again?
Thanks,
Sindre
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Ioannis Toutoulis
-
- Offline
- New Member
- Posts: 8
Krikor wrote: @Ioannis why not post it in Github, or the KED - getk2.org/extend/extensions - so people can find it and download it?
@Krikor i didn't upload it to K2 extension directory because of a bug. I have done something wrong with the Joomla or K2 Router. I created this module for a project of mine and then i tried to make it work everywhere. I wanted to solve it first but i didn't had the time these past few months. I upload it to github if you want to take a look.
github.com/johntout/mod_authorlatestarticles
Sindre Westre wrote: Hi Ioannis,
I'd like to install the module you created. Would it be possible to upload it again?
Thanks,
Sindre
No problem mate. As i mentioned above i uploaded to github. You can grab it from there. There is a bug though, so in order to make use of it read the instructions.
I don't know if that is what you are looking for. My problem was that K2 is not offering a way to see (and edit) unpublished items in frontend. So i created this module in order for my authors (that i do not want to have backend access) to see all articles. Still there is no way to see unpublished items but you can edit them from K2's classic modal window. Also you can see which articles are special or pending and articles's access levels.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
What I've done is changed the following in Components/com_K2/views/item/view.html.php:
In lines 113 and further (// Published check) change the subsequent lines from
if (!$item->published || $item->trash)
if ((!$item->published || $item->trash) AND $item->created_by != $user->id)
So the whole piece of code looks like:
// Published check
if ((!$item->published || $item->trash) AND $item->created_by != $user->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (($item->publish_up != $nullDate && $item->publish_up > $now) AND $item->created_by != $user->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (($item->publish_down != $nullDate && $item->publish_down < $now) AND $item->created_by != $user->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ((!$item->category->published || $item->category->trash) AND $item->created_by != $user->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
The code could use some more refinement, so an authorized user, like an admin or an editor can preview all unpublished articles.
(I've done some testing on V3, but bringing the admin to the frontend is not the same as a live preview of the article)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
This would require more coding. In the list view unpublished articles aren't visible, so an editor will not be able to see these articles in the frontend. Only an author can see his own (unpublished) articles.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
github.com/getk2/k2/blob/master/components/com_k2/templates/default/user.php#L95
Make sure that you are not stripping these items from your overrides.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Steven Trooster
-
Topic Author
- Offline
- Premium Member
- Posts: 130
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
This has been a part of the core for many years.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.