? Success
Referenced as Related to: # 5004

User tests: Successful: Unsuccessful:

avatar Skullbock
Skullbock
8 Nov 2014

As noticed in #5004 the JFormFieldUser field was ready to accept "groups" and "exclude" filters, but the code was actually never completed.

In JFormFieldUser class there are two functions:

  • protected function getGroups() { return null; }
  • protected function getExcluded() { return null; }

Function getInput() invoke both this methods which is totally pointless because it always assign null values to this variables:

$groups = $this->getGroups();
$excluded = $this->getExcluded();

Then this always null parameters are passed to com_users&view=users&ayout=modal view which is working pretty nice when you provide some values. For example when getGroups function is recoded to:

protected function getGroups()
    {
        if(isset($this->element['filter'])) {
            return explode(',', $this->element['filter']);
        } 
        return null;
    }
``` using filtering field in form file like: 


allows to show only users from particular user groups in modal because this filtering option is already implemented in this view (without hiding filter field).

# Testing Instructions

1) Apply the patch
2) Add a new User in Joomla and place in in a group (like Authors)
3) Open the form file of an existing component (like /administrator/components/com_contact/models/form/contact.xml)
4) Find the field with "type=user" in that file
5) Add an attribute "groups" to that xml field and place a csv list of user groups ids
6) Add an attribute "exclude" to that xml field and fill it with a csv list of user ids you want to exclude
7) Try creating a new contact from com_contact and check if selecting the user you see only the users in the "groups" and that are not "excluded"

avatar Skullbock Skullbock - open - 8 Nov 2014
avatar jissues-bot jissues-bot - change - 8 Nov 2014
Labels Added: ?
avatar roland-d roland-d - change - 8 Nov 2014
The description was changed
avatar roland-d
roland-d - comment - 8 Nov 2014

Can you please add the test instructions. Thank you.

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5027.

avatar Skullbock Skullbock - change - 9 Nov 2014
The description was changed
avatar Skullbock
Skullbock - comment - 9 Nov 2014

Done!

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5027.

avatar brianteeman brianteeman - change - 24 Jul 2015
Category Libraries
avatar roland-d
roland-d - comment - 5 Sep 2015

Tested this successfully. After changing the XML file and I create a new contact I don't get a filtered list of users. After applying the patch the list is filtered according to the XML specifications.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5027.

avatar roland-d roland-d - test_item - 5 Sep 2015 - Tested successfully
avatar zero-24 zero-24 - test_item - 5 Sep 2015 - Tested successfully
avatar zero-24 zero-24 - change - 5 Sep 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 5 Sep 2015

Tested successful. -> RTC Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5027.

avatar joomla-cms-bot joomla-cms-bot - change - 5 Sep 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 17 Sep 2015
Milestone Added:
avatar zero-24 zero-24 - change - 17 Sep 2015
Milestone Added:
avatar rdeutz rdeutz - reference | d1eb9ed - 1 Oct 15
avatar rdeutz rdeutz - merge - 1 Oct 2015
avatar rdeutz rdeutz - close - 1 Oct 2015
avatar rdeutz rdeutz - change - 1 Oct 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-10-01 18:06:51
Closed_By rdeutz
avatar rdeutz rdeutz - close - 1 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - close - 1 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - change - 1 Oct 2015
Labels Removed: ?
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone Added:
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone Added:
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone

Add a Comment

Login with GitHub to post a comment