How to filter a view based on tags applied to I'm working on an old (2009) Drupal 6 site that uses a custom module to add a field to the content creation pages for certain node types. That field lists a sub-set of the users of a certain user type.

Some of those users are now being free-tagged on the site. I'd like to be able to create a view that lists only the nodes that refer to users that have a specific tag.

If that sounds a bit complicated, here's an example. Imagine a D6 site that works as an intranet for a doctor's surgery. Each doctor has a user account on the site, as does each patient. A custom module lets patients be allocated to doctors. After every appointment, the doctor fills in a report. That report is a node type, and includes a field created by a custom module that allows the doctor to select the patient who had the appointment, from a list of all of the patients who are allocated to that doctor.

Now, imagine that each patient's account could be free-tagged, and tags such as "male", "female", "diabetic", "pregnant", etc. were added to the patients' user accounts. How would I go about building a view that would display all of the reports given to patients who are tagged as "pregnant"?
So, shortly after posting this question I worked out how to do it.

When I built this site I included the facility to create a Views relationship that points at the "referred to" user (the "patient" in the above example). So, I created this relationship in the view that I built. I then created another relationship that was itself based on the first relationship but pointing at the node created by the Content Profile module.

Then, I created a filter based on the second relationship, that filtered based on the taxonomy term I'd created (i.e., the "diabetic", "pregnant" stuff above). That did the trick.