Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

k2 articles in Joomla become unpublished if the author makes a minor change from the Frontend

The "Authors" group doesn't have any publish rights. This is ok. So an Editor/Administrator does an initial approve of any article.

Problem comes if the Author decides to edit the already published article. When he hit "save" from the frontend, the item immediately becomes unpublished.(Because authors group doesn't have the right to publish items). So, this a huge problem at least for my case.

I want articles to remain published after the initial approval of the admin, even if the author makes adjustments. Any idea how to do something like this?

This logic comes as the default way of doing things in the Joomla Core.

like image 880
George D. Avatar asked Nov 10 '12 12:11

George D.


3 Answers

You may want to consider switching from K2 to something like else like EasyBlog then... Or just don't use K2. It seems like the default for K2 is to follow a workflow that conflicts with yours.

Otherwise you can modify K2 to suit your needs... I really don't recommend modifying extensions because then you can no longer make updates to them unless you plan to make the modifications every time you update (which is a pain).

You problem resides in the administrator/components/com_k2/models/item.php The following lines are form version 2.6.1 line 785.

        if ($front)
        {
            if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published)
            {
                $row->published = 0;
                $mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
            }
        }

If I understand you correctly you want something more like:

    if ($front)
    {
        $row->published = 1;
        if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published && $isNew)
        {
            $row->published = 0;
            $mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
        }
    }

If I understand their model right by adding a check for $isNew to the if statement it will only apply published = 0 to new entries. Which, if I understand you, are the only ones you want to affect. This way if if the article already exists and it's published it will always stay published unless an admin changes it to unpublished.

I'm not sure if this will work the way I expect so let me know.

like image 50
Cleanshooter Avatar answered Nov 08 '22 20:11

Cleanshooter


You should either allow Authors to edit any item or disable option for editing articles for authors.

like image 32
Nutic Avatar answered Nov 08 '22 19:11

Nutic


Go to your joomla administration, go to k2 menu and in User Groups tabs create a group called editors and give it access to Publish item, then go back to Users tab and put those users that you want to make them editor in editors group.

Make sure your editor group users have access to Front-end item editing and Edit any item.

Your problem is because your editors have Edit any item access but they don't access to Publish item.

like image 1
Farid Rn Avatar answered Nov 08 '22 21:11

Farid Rn