- Posts: 26
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Seeing unpublished items when logged in front end
[SOLVED] Seeing unpublished items when logged in front end
- Dave Sage
- Topic Author
- Offline
- Junior Member
Had a surprise that I couldn't see unpublished items in the front end when logged in as an admin. This is standard within normal Joomla article flow, so people can edit the articles in the front end and then publish them. Is this missing feature likely to be added to K2?
Cheers,
Dave
Please Log in or Create an account to join the conversation.
- jeff vandenberg
- Offline
- New Member
- Posts: 1
Is there any plans for allowing unpublished to be viewed in some way on the front end? Is there a way to do it that I am just not seeing?
Thanks,
Jeff
Please Log in or Create an account to join the conversation.
- Nicolas
- Offline
- New Member
- Posts: 10
Need the same thing here !
It's very weird that a user (manager for example) can't see all the unpublished K2 item in frontend for managing them.
Please Log in or Create an account to join the conversation.
- Mhamed Lahmar
- Offline
- New Member
- Posts: 3
Please Log in or Create an account to join the conversation.
- TalkEZY.com
- Offline
- New Member
- Posts: 4
I'm having the same issue here I had to create an new ACL as awork around and set new things to publish to that group... thats not good K2
:ohmy:
Please Log in or Create an account to join the conversation.
- george
- Offline
- New Member
- May The Force be with you.
- Posts: 12
Open components/com_k2/models/itemlist.php
Around line 339 under this line
JPluginHelper::importPlugin('k2');
put this code
// Lollypop.gr fix
$lollygroups = array();
foreach ($user->groups as $key => $value){
$lollygroups[] = $key;
}
if(in_array(3,$lollygroups) OR in_array(8,$lollygroups)){
$query = str_replace("i.published = 1 AND","",$query);
}
// EOF lollypop.gr fix
So with this hack allow Admins and authors to view Un-bpublished items in category listings. The ID's 3 and 8 are for Authors and Superadmins in a default Jinstallation. You can put many more if you like other groups to see this as well.
Also in the overridden view file /templates/templatename/html/com_k2/default/category_item.php
around line 54 add this line, so you can see what articles are un-published
<?php if($this->item->published==0) {?><span><sup>Unpublished</sup></span><?php }?>
And at last, in order to see the un-published item you do something similar.
open /components/com_k2/views/item/view.html.php and around line 106 replace this
if (!$item->published || $item->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
with this
// Published check
//
if (!$item->published){
// Lollypop fix
$lollygroups = array();
foreach ($user->groups as $key => $value){
$lollygroups[] = $key;
}
if(!in_array(3,$lollygroups) AND !in_array(8,$lollygroups)){
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
// EOF lollypop
}
if ($item->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
It worked perfect for me.
Please Log in or Create an account to join the conversation.
- Jay Reeves
- Offline
- New Member
- Posts: 5
However when the unpublished article is viewed on the frontend, it will say "Published in..." even though it's not published. It makes it hard to tell what is and is not published, without knowing firsthand.
I think this is a very serious flaw or oversight on the K2 developers part.
I like a lot of the features the K2 brings, but there are places the Joomla core still smokes. Here are some issues I see that K2 could correct to make it rock:
1) the K2 frontend editor window does not close automatically on a save and return you to the page you started from - you have to close it (there's been reports of conflicts with JQuery, but I can't find that occuring on a site I have)
2) K2 Items created on the frontend by an author, cannot be easily edited and published via the frontend by anyone else, even SU.
3) When a K2 item is created on the frontend by an author, there is no notification anywhere to anyone. Joomla can send an email notification - very nice!
I'm at the point to where K2 is going to be ripped out of my sites - the above items are deal breakers for me.
Please Log in or Create an account to join the conversation.
- hibrix
- Offline
- New Member
- Posts: 2
thanks in advance,
Please Log in or Create an account to join the conversation.
- Cody
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- george
- Offline
- New Member
- May The Force be with you.
- Posts: 12
Jay Reeves wrote: However when the unpublished article is viewed on the frontend, it will say "Published in..." even though it's not published. It makes it hard to tell what is and is not published, without knowing firsthand.
I am not sure I understand your point. Did you used the template hack? Its easy to see what is unpublished because of the
<?php if($this->item->published==0) {?><span><sup>Unpublished</sup></span><?php }?>
You can use some css to the span element to make it even more clear. So you just ignore the "Published in..." line and check for this span in the listing.
Again I say, this is not the best way to go, but sure its a hack to bypass this problem. The un-cool side of hacks is that you must do this in each and every upgrade. Hope someone from the DEV team to look for this issue.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Seeing unpublished items when logged in front end