Skip to content

[4.1] Articles filtered by me #2214

@jgerman-bot

Description

@jgerman-bot

New language relevant PR in upstream repo: joomla/joomla-cms#36555 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/components/com_content/forms/filter_articles.xml b/administrator/components/com_content/forms/filter_articles.xml
index 73c1bb84e6f3..5bc5cf786f44 100644
--- a/administrator/components/com_content/forms/filter_articles.xml
+++ b/administrator/components/com_content/forms/filter_articles.xml
@@ -76,6 +76,7 @@
 			onchange="this.form.submit();"
 			>
 			<option value="0">JNONE</option>
+			<option value="by_me">COM_CONTENT_FILTER_AUTHORS_BY_ME</option>
 		</field>
 
 		<field
diff --git a/administrator/components/com_content/src/Model/ArticlesModel.php b/administrator/components/com_content/src/Model/ArticlesModel.php
index ea629cbb71fb..963f48980766 100644
--- a/administrator/components/com_content/src/Model/ArticlesModel.php
+++ b/administrator/components/com_content/src/Model/ArticlesModel.php
@@ -352,7 +352,7 @@ protected function getListQuery()
 		// Filter by featured.
 		$featured = (string) $this->getState('filter.featured');
 
-		if (in_array($featured, ['0','1']))
+		if (\in_array($featured, ['0','1']))
 		{
 			$featured = (int) $featured;
 			$query->where($db->quoteName('a.featured') . ' = :featured')
@@ -462,6 +462,14 @@ protected function getListQuery()
 		}
 		elseif (is_array($authorId))
 		{
+			// Check to see if by_me is in the array
+			if (\in_array('by_me', $authorId))
+
+			// Replace by_me with the current user id in the array
+			{
+				$authorId['by_me'] = $user->id;
+			}
+
 			$authorId = ArrayHelper::toInteger($authorId);
 			$query->whereIn($db->quoteName('a.created_by'), $authorId);
 		}
diff --git a/administrator/components/com_content/tmpl/articles/default.xml b/administrator/components/com_content/tmpl/articles/default.xml
index 79885752f859..c0f6b39be802 100644
--- a/administrator/components/com_content/tmpl/articles/default.xml
+++ b/administrator/components/com_content/tmpl/articles/default.xml
@@ -43,9 +43,10 @@
 				multiple="true"
 				layout="joomla.form.field.list-fancy-select"
 				class="multipleAuthors"
-				filter="intarray"
+				filter="array"
 				>
 				<option value="0">JNONE</option>
+				<option value="by_me">COM_CONTENT_FILTER_AUTHORS_BY_ME</option>
 			</field>
 
 			<field
diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini
index 23dcc8ccc7d5..e7186424eeef 100644
--- a/administrator/language/en-GB/com_content.ini
+++ b/administrator/language/en-GB/com_content.ini
@@ -97,6 +97,7 @@ COM_CONTENT_FIELDS_TYPE_MODAL_ARTICLE="Article"
 COM_CONTENT_FIELDSET_PUBLISHING="Publishing"
 COM_CONTENT_FIELDSET_RULES="Permissions"
 COM_CONTENT_FIELDSET_URLS_AND_IMAGES="Images and Links"
+COM_CONTENT_FILTER_AUTHORS_BY_ME="Created by me"
 COM_CONTENT_FILTER_FEATURED_NO="Unfeatured Articles"
 COM_CONTENT_FILTER_FEATURED_YES="Featured Articles"
 COM_CONTENT_FILTER_SEARCH_DESC="Search in title, alias and note. Prefix with ID: or AUTHOR: or CONTENT: to search for an article ID, article author or search in article content."

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions