I'm using Articles Field version 3.3.0 PRO on a Joomla! 3.9.19 site to create a Users custom field which allows me to link content articles to users. I want to filter the articles on category and language. For the language filter I chose 'Current', expecting the articles to be filtered on the language of the designated user. When editing a user, I now get the following message:
Warning: Invalid argument supplied for foreach() in D:\www\dma20.yolknet\public\plugins\fields\articles\fields\articles.php on line 259
The PhpStorm debugger shows me that the language filter value passed to the query contains an '*'. The row count now returns a total which exceeds the 'max_list_count' (can that be configured anywhere?), making the JFormFieldArticles::getOptions() return a value of -1, which results is the foreach() warning.
Is this a flaw or am I misinterpreting the language filter 'Current' setting?
Warning: Attempt to assign property 'level' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 235
Notice: Trying to get property 'level' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 252
Notice: Trying to get property 'level' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 259
Notice: Trying to get property 'value' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 284
Notice: Trying to get property 'value' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 289
Notice: Trying to get property 'value' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 289
Notice: Trying to get property 'value' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 292
Notice: Trying to get property 'text' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 292
Notice: Trying to get property 'level' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 297
Notice: Trying to get property 'level' of non-object in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 301
If that still doesn't work, can you give me (super) admin and (s)ftp access so I can take a look?
And tell me on what url I can see/reproduce the issue.
You can use the 'Hidden text' button in the forum editor to hide the confidential information.
Notice: Undefined property: stdClass::$text in D:\www\dma20.yolknet\public\libraries\regularlabs\src\Form.php on line 292
If I select a specific language, the field shows me articles in the selected language, as it should. But when selecting 'Current' I get the notice without any articles. The PhpStorm debuggers still shows '*' as the selected language filter. That seems odd.
The site I'm working on is on a local machine and currently not publicly available. Is that really necessary?
Did some more digging. It appears that PlgFieldsArticlesFilters::get() retrieves the current language from the PlgFieldsArticlesFilters::getCurrentArticleLanguage(). But since we have no current article but a current user, that method returns '*' by default.
Even without reproducing the actual issue, it's quite clear in the code what what the problem is, like I explained in my previous post:
It appears that PlgFieldsArticlesFilters::get() retrieves the current language from the PlgFieldsArticlesFilters::getCurrentArticleLanguage(). But since we have no current article but a current user, that method returns '*' by default.
I'll first see if I can find another solution for my challenge.
I probably could fix it, but it's not as easy as it seems. The Articles field seems to be coded with article/article relations and not with article/user or article/contact relations in mind. So making it suitable for those other two components, takes more than adding/modifying one or two lines of code. For starters, users have two language settings: frontend and backend. That would require adjustments to the custom field's parameters and UI as well.
Correct, The language filter (among others) in Articles Field concerns the article data. Not user data.
So when using the language filter on user custom fields, it will just default to all languages.
But it doesn't throw any errors on my setups. The '*' value is handled just fine.
Currently there are no plans to make a user language filter in Articles Field.