Keyword

Author can't view his own unpublished item

  • Steven Trooster
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 4 months ago #149686 by Steven Trooster
Author can't view his own unpublished item was created by Steven Trooster
On my site editors can post items through the frontend of the site. They can addd a new item and edit their own, but can't publish. An admin has to go to the backend of the site to review the article and publish it. For an editor it is frustrating they can't preview their full article after submitting, when it's not published yet. They only see the intro text on their page.
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #149698 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
Hello Steven,

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
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 4 months ago #149715 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
Ok, thank you.
I hardly dare to ask: any news on the V3 release?

Please Log in or Create an account to join the conversation.

More
9 years 4 months ago - 9 years 4 months ago #149716 by Ioannis Toutoulis
Replied by Ioannis Toutoulis on topic Author can't view his own unpublished item

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
Last edit: 9 years 4 months ago by Ioannis Toutoulis.

Please Log in or Create an account to join the conversation.

  • Steven Trooster
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 4 months ago #149717 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
Thank you Ioannis, but this won't solve my problem. Point is, the author would like to see a preview of the text. We notice that an author edits his posts a lot of times after the article is published.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #149754 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
@Ioannis Unfortunately I cannot share a date for K2 version 3.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 months ago #150854 by Sindre Westre
Replied by Sindre Westre on topic Author can't view his own unpublished item
Hi Ioannis,
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #150878 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
@Ioannis why not post it in Github, or the KED - getk2.org/extend/extensions - so people can find it and download it?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 months ago - 9 years 2 months ago #150879 by Ioannis Toutoulis
Replied by Ioannis Toutoulis on topic Author can't view his own unpublished item

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.
Last edit: 9 years 2 months ago by Ioannis Toutoulis.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 2 months ago #150913 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
You can always try copying K2 Content's (module) helper.

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
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago - 8 years 5 months ago #159251 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
I've come up with a hack to let users view their own articles, before the article is published. (This was an overwhelming request from the authors on my site) This is important, because the author wants to see the final result of the article, before it goes online.

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)
to
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)
Last edit: 8 years 5 months ago by Steven Trooster. Reason: Added the name of the file that has been altered

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 5 months ago #159259 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
It looks nice but if you add the Super User's group in the check it will be better :)

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
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago #159280 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
I would suggest a setting for users groups that would allow a the users in that group to view unpublished items. Not just super users. In my case editors check articles before they are published.
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 5 months ago #159306 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
A Super user imho should be able to see all items (if he/she is dealing with the content) this is why I suggested that that groups should see these items as well.

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
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 7 months ago #163791 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
Too bad the recent K2 update still doesn't have an option for authors to preview their own (draft) articles…

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #163829 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
In the default template the check is there,
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
  • Steven Trooster's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 7 months ago #163853 by Steven Trooster
Replied by Steven Trooster on topic Author can't view his own unpublished item
I see. It's quite difficult when functionality is in a template. Makes it hard to update your own template, since you have no clue what's been updated in the core and what in de default template.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #163860 by Krikor Boghossian
Replied by Krikor Boghossian on topic Author can't view his own unpublished item
Everything has to be displayed in the frontend. This is a feature that has to be represented in the frontend as well.
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.


Powered by Kunena Forum