User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This sets up site Articles model to allow filtering articles by no author, like in administrator.
Create an article without author.
Modify 'Articles - Category' module form (/modules/mod_articles_category/mod_articles_category.xml) by adding option with value 0 to created_by field. So the field looks like this:
<field
name="created_by"
type="sql"
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_LABEL"
description="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_DESC"
multiple="true"
size="5"
query="select id, name, username from #__users where id IN (select distinct(created_by) from #__content) order by name ASC"
key_field="id"
value_field="name"
>
<option value="">JOPTION_SELECT_AUTHORS</option>
<option value="0">JNONE</option>
</field>
Publish the module. In author field try these combinations:
a) No option
b) Option with empty value
c) Option with 0 value
d) Option with empty value and option with 0 value
e) Option with empty value and option with >= 1 value (e.g. author with ID 50)
f) Option with 0 value and option with >= 1 value (e.g. author with ID 50)
a) All articles are shown
b) All articles are shown
c) Only articles without author are shown
d) Only articles without author are shown
e) Only articles from selected author (e.g. author with ID 50) are shown
f) Articles from selected author (e.g. author with ID 50) and without author are shown
a) All articles are shown (correct)
b) All articles are shown (correct)
c) All articles are shown (incorrect)
d) Only articles without author are shown (correct)
e) Articles from selected author (e.g. author with ID 50) and without author are shown (incorrect)
f) Articles from selected author (e.g. author with ID 50) and without author are shown (correct)
No.
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_content |
This PR doesn't include any changes in XML.
Editing XML is needed to test the code, in which case the file is /modules/mod_articles_category/mod_articles_category.xml.
I have tested this item
@infograf768 You could do that, yes. But this PR doesn't touch XML. Editing XML is only needed to test the code. And note that option with empty value is for cosmetic reasons only. The existence of this option caused another issue, which is solved in this PR:
If you select an author (e.g. ID 50) and leave the default option selected, the value passed to model is array('', '50')
. Using ArrayHelper::toInteger()
results in array(0, 50)
which means articles without author (where author ID is 0) will be included alongside articles from author with ID 50.
I'll update testing instructions with option combinations.
EDIT: Whoops, wrong button.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-28 08:45:04 |
Closed_By | ⇒ | SharkyKZ | |
Labels |
Added:
?
|
Status | Closed | ⇒ | New |
Closed_Date | 2018-04-28 08:45:04 | ⇒ | |
Closed_By | SharkyKZ | ⇒ |
Status | New | ⇒ | Pending |
OK. I guess using the author field instead would be a better solution.
But that is already in your other PR.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-30 22:33:04 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
@SharkyKZ were change in
xml
files ? And why is it needed in fornt?In
adminstrator/com_content/views/articles
this would be a very useful filter