Hi,
I’m trying to work out how to filter a display based on the company a user is associated with.
The idea being that all users go to the same custom display page but instead of only showing entries that that user id has entered, it shows all entries of the company that user is a member of.
So, I have a series of users linked by which company they are in, I’m sending them to a list of events that a number of different companies have published, but I only want to show the events that relate to their company.
I’ve used the where filter before to tag content:
company – is equal to – [get param=company]
on the list of events but I’m a bit stumped as to what to write in the custom display as before I’ve only used this:
[display-frm-data id=101 get=company filter=1 get_value=[id]]
Which works to show only the entries from that user, but I have no idea how to filter based on other aspects of that users profile.
All users have signed up via the registration plugin and so there is a form that links every user to a specific company.
Am I going about this wrong? Do I instead filter the custom display based on if statements… [if 234 equals=[companyx] show the data[/if 234]?
Thanks in advance,
Rich




November 1, 2012 at 9:30 am
How is a user linked to a company? Where is the relationship stored? In the WP profile as user meta? Somewhere else? You will need to use this hook and first get the user ids related to that company.
http://formidablepro.com/knowledgebase/frm_where_filter/
November 1, 2012 at 10:14 am
Hi,
Thanks - the user is added using a user profile form which registers them via the formidable registration plugin. The new user form asks them to select from a data from entries list of companies. The companies are added through a separate form which only I have access to. So, each user is linked to a company through their registration form.
I saw the http://formidablepro.com/knowledgebase/frm_where_filter/ page when I was trying to find an answer on the site, it's a little beyond me, but I will give it a go! I'm sure I'll learn something new either way!
Thanks! I will of course let you know how it goes, bet you can't wait...
Rich
November 1, 2012 at 4:26 pm
Hi Stephanie,
After trying to get the php to work (something I simply shouldn't ever do TBH) I realised that I could come at it from a different angle. Instead, I've used the
where userID = current user to create a 'company' custom display.
I then nested an event list inside that.
The result was a dynamic display of the companies, with a list of events inside.
I then used another custom display to create a link that is unique to that user that links straight to the dynamic page of events.
Hey presto a list of events, unique to a company that responds to the user.
I think I lost a few brain cells in the process though.
Rich
Topic closed.