Views filter handler for user authored from Custom Form How can I make a custom views filter handler to filter a list of users which the current user created?

For example: The user adds members to the site a view will show only the members that the user added.

In views, there is a relationship for sorting content based on the current user "Content authored" which is similar.
As pointed out by 4k4 there is no user authored data in the tables, so I thought I would add what I did to output a view of users the author created.

For me, I needed to do some of this in my custom module you might be able to do this in the configuration if your use case is easier.

 1. Create user reference field in /admin/config/people/accounts/fields
 2. Install https://www.drupal.org/project/cer/
 3. Add a corresponding reference in /admin/config/content/cer for your field and the user entity.
 4. Create a relationship for your view from the user field.
 5. Output your view as a block list on your user account page.


Now when a user creates a reference the view will shorten to a list of your users. 

I took this a step further and created a custom form module to register a user and in code populate the user entity reference field with a form submit for the current user's id. This bit took me a while to work out so hope this helps someone else. :)

$userCurrent = \Drupal::currentUser();
$uid = $userCurrent-&gt;id();
$user-&gt;set("field_your_field_name",$uid);