Bug with usergroup element

jfquestiaux

Well-Known Member
I am using the usergroup element in a form but it seems to be a bug:
When you create a new record, check only one group, it shows correctly in the list but if you try to edit the form, you have the following warning (about a whole page of it):

Warning: in_array() expects parameter 2 to be array, string given in /home/livingjfq/public_html/j3/libraries/joomla/html/access.php on line 167

and the previously checked group appears unchecked on the form.

However, if you check two (or I suppose more) groups, everything works fine (in the list and on edit).

The reason is that when you have a single group, the element saves the group ID under : 2 (for instance) while it should save it under JSON format : ["2"]
For multiple groups, it saves correctly : ["2","3"]

I looked at the element but can't see where it does any saving.

Tested on J! 3.1.1 and latest GitHub.
 
Also, if I want to filter on this element with a dropdown filter, I get the values of the element in the filter options (I could live with that) but if I choose one option it returns no result, even though there are records.
 
I think you need to be using the 'usergroup' element and not the 'access' element (which i think is deprecated)
 
Hi Rob. I am using the usergroup element. I tested the two other (access and viewlevel) and it is the 'usergroup' that is what I need, but it has the prblems described above.
 
oh sorry my bad, I saw the file access.php and thought you were using the access element :oops:
Should be fixed now
 
OK, the main issue is fixed (the warning when there is only one usergroup), but the filter issue is still there: with a dropdown filter, I get the values (the groups IDs) of the element in the filter options and the filter only works if the user belongs to only one group.
If a user belongs to more than one group, the filter returns "no result".

Example : user 1 : "Registered" group - user 2: "Registered" and "group1" groups

Filtering on "Registered" will return only "user1"
Filtering on "group1" will return "no result"
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top