Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] Articles filtered by me #114

Closed
joomlapl-bot opened this issue Jan 10, 2022 · 0 comments
Closed

[4.1] Articles filtered by me #114

joomlapl-bot opened this issue Jan 10, 2022 · 0 comments

Comments

@joomlapl-bot
Copy link
Collaborator

PR w związku ze zmianą oryginału joomla/joomla-cms#36555 Poniżej zmiany w oryginale:

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."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants