Keyword

[SOLVED] Seeing unpublished items when logged in front end

  • Dave Sage
  • Dave Sage's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #62864 by Dave Sage
Hi,

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.

More
12 years 1 month ago #62865 by jeff vandenberg
Replied by jeff vandenberg on topic Re: Seeing unpublished items when logged in front end
This is also a non-trivial concern for me as well. I saw the work around suggestion of having an 'unpublished' category that people can post to, but that seemed suboptimal. I do find this to be a flaw in an otherwise very useful package.

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.

More
12 years 5 days ago #62866 by Nicolas
Hi,
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.

More
11 years 11 months ago #62867 by Mhamed Lahmar
Replied by Mhamed Lahmar on topic Re: Seeing unpublished items when logged in front end
same problem here...

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

More
11 years 8 months ago #62868 by TalkEZY.com
:angry:
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
  • george's Avatar
  • Offline
  • New Member
  • May The Force be with you.
More
11 years 6 months ago - 11 years 6 months ago #62869 by george
I had the same problem and I did this hack to fix this. Please make sure you have a backup and of course as with all hacks you should do this in each and every upgrade you make. The fix is not the best, but sure its tha fastest way to solve this issue.

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.

More
11 years 4 months ago #62870 by Jay Reeves
Thanks, George, for doing that. It does make the unpublished article appear on the frontend.

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.

More
11 years 3 months ago #62871 by hibrix
i made the hack you suggested but i still retrieve 404 errors when i try to preview unpublished items from the frontend. Any suggestion?

thanks in advance,

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

More
11 years 3 months ago #62872 by Cody
But you can see the unpublished articles! Create a link to the users -userpage(blog)- and the unpublished articles for that user show up in their blog. They can edit the article and publish it from there. It works on my K2 that way anyway. Hope this helps someone. :cheer:

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

  • george
  • george's Avatar
  • Offline
  • New Member
  • May The Force be with you.
More
11 years 2 months ago - 11 years 2 months ago #62873 by george

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.


Powered by Kunena Forum