Skip to content
Open
5 changes: 5 additions & 0 deletions administrator/language/en-GB/com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ COM_CONTENT_FEATURED_ORDER="Featured Articles Order"
COM_CONTENT_FEATURED_TABLE_CAPTION="Featured Articles"
COM_CONTENT_FEATURED_TITLE="Articles: Featured"
COM_CONTENT_FIELD_ARTICLETEXT_LABEL="Article Text"
COM_CONTENT_FIELD_AUTHORFILTERING_LABEL="Author Filtering Type"
COM_CONTENT_FIELD_AUTHOR_LABEL="Authors"
COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_LABEL="Browser Page Title"
COM_CONTENT_FIELD_CAPTCHA_LABEL="Allow Captcha on submit"
COM_CONTENT_FIELD_CREATED_BY_ALIAS_LABEL="Created by Alias"
Expand Down Expand Up @@ -152,6 +154,9 @@ COM_CONTENT_NEW_ARTICLE="New Article"
COM_CONTENT_NO_ARTICLES_LABEL="No Articles Message"
COM_CONTENT_NO_ITEM_SELECTED="Please first make a selection from the list."
COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL="# Articles in Category"
COM_CONTENT_OPTION_EXCLUSIVE_VALUE="Exclude"
COM_CONTENT_OPTION_INCLUSIVE_VALUE="Include"
COM_CONTENT_OPTION_ONLYCURRENTUSER_VALUE="Current User"
COM_CONTENT_OTHER_OPTIONS="Options"
COM_CONTENT_PAGE_ADD_ARTICLE="Articles: New"
COM_CONTENT_PAGE_EDIT_ARTICLE="Articles: Edit"
Expand Down
12 changes: 12 additions & 0 deletions components/com_content/src/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ protected function populateState($ordering = null, $direction = null)

// Set the featured articles state
$this->setState('filter.featured', $params->get('show_featured'));

$authorFilteringType = (int) $params->get('list_author_filtering_type', 1);

if ($authorFilteringType === 2) {
$this->setState('filter.author_id', [(int) $user->id]);
$this->setState('filter.author_id.include', true);
} else {
$this->setState('filter.author_id', (array) $params->get('list_author', []));
$this->setState('filter.author_id.include', (bool) $authorFilteringType);
}
}

/**
Expand Down Expand Up @@ -247,6 +257,8 @@ public function getItems()
$model->setState('list.direction', $this->getState('list.direction'));
$model->setState('list.filter', $this->getState('list.filter'));
$model->setState('filter.tag', $this->getState('filter.tag'));
$model->setState('filter.author_id', $this->getState('filter.author_id'));
$model->setState('filter.author_id.include', $this->getState('filter.author_id.include', true));

// Filter.subcategories indicates whether to include articles from subcategories in the list or blog
$model->setState('filter.subcategories', $this->getState('filter.subcategories'));
Expand Down
27 changes: 26 additions & 1 deletion components/com_content/tmpl/category/blog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@

</fieldset>

<fieldset name="advanced" label="JGLOBAL_BLOG_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_BLOG_LAYOUT_LABEL">
<fieldset name="advanced" label="JGLOBAL_BLOG_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_BLOG_LAYOUT_LABEL"
addfieldprefix="Joomla\Component\Content\Administrator\Field"
>

<field
name="num_leading_articles"
Expand Down Expand Up @@ -263,6 +265,29 @@
<option value="only">JONLY</option>
</field>

<field
name="list_author_filtering_type"
type="list"
label="COM_CONTENT_FIELD_AUTHORFILTERING_LABEL"
default="1"
filter="integer"
>
<option value="0">COM_CONTENT_OPTION_EXCLUSIVE_VALUE</option>
<option value="1">COM_CONTENT_OPTION_INCLUSIVE_VALUE</option>
<option value="2">COM_CONTENT_OPTION_ONLYCURRENTUSER_VALUE</option>
</field>

<field
name="list_author"
type="author"
label="COM_CONTENT_FIELD_AUTHOR_LABEL"
multiple="true"
layout="joomla.form.field.list-fancy-select"
filter="intarray"
class="multipleAuthors"
showon="list_author_filtering_type!:2"
/>

<field
name="link_intro_image"
type="list"
Expand Down
23 changes: 23 additions & 0 deletions components/com_content/tmpl/category/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,29 @@
<option value="month">JMONTH_PUBLISHED</option>
</field>

<field
name="list_author_filtering_type"
type="list"
label="COM_CONTENT_FIELD_AUTHORFILTERING_LABEL"
default="1"
filter="integer"
>
<option value="0">COM_CONTENT_OPTION_EXCLUSIVE_VALUE</option>
<option value="1">COM_CONTENT_OPTION_INCLUSIVE_VALUE</option>
<option value="2">COM_CONTENT_OPTION_ONLYCURRENTUSER_VALUE</option>
</field>

<field
name="list_author"
type="author"
label="COM_CONTENT_FIELD_AUTHOR_LABEL"
multiple="true"
layout="joomla.form.field.list-fancy-select"
filter="intarray"
class="multipleAuthors"
showon="list_author_filtering_type!:2"
/>

<field
name="show_headings"
type="list"
Expand Down