Filter records based on user's company

I'm trying to find the best way to filter lists to show only records from where the record shares the user's company value. I currently have a fabrik_users table that stores a company name (databasejoin) and also creates new juser records. Two parts to this problem, I think:
Storing the user's company name in...session? Since there are multiple tables where the same sort of filter will be applied, it'd be nice if I could access a value from the user object or a session object so that I don't constantly need to re-query each time the user wants to see another table.

Filtering the list: I've been able to create a canviewrow plug-in filter. But that plugin only removes the link to the details view. It doesn't actually remove the row from the records displayed in the list view. Other places I've tried to put a filter (menu item, menu url, table pre-filter) only show one little input field to store a filter. My filter will require multiple lines of code, so none of these places seem right.

So two questions:
  • what's the best way to make the user's company value accessible?
  • what's the best way to show only records that match the user's company?
 
Ah, thanks! I didn't even notice the plus sign and was trying to stuff my whole query into the PreQuery Filter input field. Following that thread, I was able to update the query style and get the right result. Cheers!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top