bck2sqr1 Posted December 15, 2015 Posted December 15, 2015 I'm still a bit of a PHP newbie so bear with me....I currently have roles setup for "Region Managers" and "Teams" for my front-end. Is there a way for me populate a list of pages made by multiple users with the same role? For ex, if Johnny and Ted have the role "T1", I want them to only see pages created with that role. Then for the "Region Managers", I want them to see all pages created with the roles "T1", "T2", "T3" etc. I was hoping there was a command like "created_users_roles" but alas...so I tried something like this and of course it didn't work... if($user->hasRole("region-manager")){$posts = $pages->find("template=form_entries,roles=t1,include=hidden");} if($user->hasRole("t1")){$posts = $pages->find("template=form_entries,roles='t1',include=hidden");} Thanks for any help you might be able to give me.
LostKobrakai Posted December 15, 2015 Posted December 15, 2015 Maybe this will work. if($user->hasRole("t1")){ $posts = $pages->find("template=form_entries, created_users_id=[template=user, roles=t1], include=hidden"); }
bck2sqr1 Posted December 15, 2015 Author Posted December 15, 2015 Maybe this will work. if($user->hasRole("t1")){ $posts = $pages->find("template=form_entries, created_users_id=[template=user, roles=t1], include=hidden"); } Thanks for the suggestion! Took a little tweaking but I got it to work! Cheers! $t1 = $pages->get("roles=t1"); if($user->hasRole("t1")){ $posts = wire("pages")->find("template=form_entries,created_users_id=$t1,include=hidden"); }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now