[solved]List filter: Display only if created by member of X usergroup

Status
Not open for further replies.

mygunfriday

Member
Can someone help me on this... I haven't used the filters much and I can't find a clear answer to how to do this.

I have members making records.
Members can belong to more than 1 usergroup.
Usergroups can change periodically based on the member's actions.

So the records have the user's ID, but not the usergroup, since the usergroup can change, but the ID cannot.

I want to be able to display the records to visitors to the site based on the usergroup the member is in.
So, if I have 500 members and only 50 are members of the Canada Usergroup, then I want to create a list view that only displays records for users who are part of the Canada Usergroup.

There are a couple other issues.
1. I would like to calculate that a visitor is from Canada - so the user just goes to a page and see's Canada data. I can do this with php and get a value of $usergroup=canada or similar, but I don't know how/where I would use this.

2. I want to use the
{fabrik view=list id=x resetfilters=1 layout=div} method of displaying the form in an article. So I don't think I can use the menu item options to pre-filter the list.

Any thought on how best to do this?

- Jeremy
 
I thought I had a solution, but it's not picking up a change to the user's group id....
Initially, this seems to work, but missed an added group_id for the user.

What I've done is,
set up a Left Join between my main table and the joomla_user_usergroup_map table which lists the user_id and the group_id (user_id's appear more than once if a user is in more than one group).

I then created a pre-filter with where contains [eval: case for each country returns desired group_id].

Logically, this seems like it would work, but if I add a user to the group Canada, the joined table doesn't include it in the group_id element data. I tried this with the data display mode as separately and merged, but the new group ID doesn't display in the joined table.

I did confirm that the joomla_user_usergroup_map table does reflect the change. I refreshed my browser cache to no avail... I added a new entry in the main table and this displays fine.

Can someone explain what I'm missing here?
 
Oops...

Figured out my glitch...

I had copied my main test site to another subdomain and installed to a separate database. I forgot that Fabrik keeps it's connection to the original database and doesn't follow Joomla automatically. So my joomla changes were in the new database and my fabrik changes were in the old database - very confusing, but once I realized my mistake - I'm all fixed.

Thanks ME.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top