Skip to content

Commit

Permalink
Method canEditState() for featured articles
Browse files Browse the repository at this point in the history
Method canEditState() copied from article.php into feature.php and modified such that it checks the "content_id" field of the "#__content_frontpage" table (the code in article.php doesn't fit to that table).
  • Loading branch information
jo-sf committed Mar 10, 2018
1 parent d3856de commit bfb126d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions administrator/components/com_content/models/feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@
*/
class ContentModelFeature extends ContentModelArticle
{
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();

// Check for existing article.
if (!empty($record->content_id))
{
return $user->authorise('core.edit.state', 'com_content.article.' . (int) $record->content_id);
}

// Default to component settings if article unknown.
return parent::canEditState($record);
}

/**
* Returns a Table object, always creating it.
*
Expand Down

0 comments on commit bfb126d

Please sign in to comment.