Search
Other Articles Field questions
Forum

User custom field filtered by language

Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Hi Peter,

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?

Regards,

Pieter-Jan de Vries
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Getting a warning and a bunch of notices now:
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
Peter van Westen's Avatar Peter van Westen ADMIN
Well, that's not good!

Please try the new dev version I just released.
regularlabs.com/development-releases

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.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
Still no articles and one notice:
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?
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
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.
Peter van Westen's Avatar Peter van Westen ADMIN
I have not been able to reproduce this issue.

If you can reproduce this on an online environment to which I can get access, I am happy to look into this.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
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.
Peter van Westen's Avatar Peter van Westen ADMIN
If you can fix it in the code and send it, I can review it. Otherwise, let me know when you can reproduce it on a setup to which I can get access.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
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.
Peter van Westen's Avatar Peter van Westen ADMIN
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.
Please post a rating at the Joomla! Extensions Directory
Pieter-Jan de Vries's Avatar Pieter-Jan de Vries
I'll try to find another solution. Thanx for your time.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription