Manaus Posted December 2, 2013 Share Posted December 2, 2013 Hello, I'm trying to ckech whether a user is allowed to see a specific page. The page has a Page field, holding the assigned users. I tried $page->allowedusers = $user, $page->has($user) and so on, but it's not working... Thanks for any help. Link to comment Share on other sites More sharing options...
Marty Walker Posted December 2, 2013 Share Posted December 2, 2013 I think Wanze showed me this a while back. <? if ($page->allowedusers->has($user)) { //your stuff } ?> 1 Link to comment Share on other sites More sharing options...
Harmster Posted December 2, 2013 Share Posted December 2, 2013 Also, from the API: $page->viewable() Is the page viewable by the current user? Returns true or false. Note that this is only useful on pages other than the current page being viewed, as ProcessWire won't let the user load a page (by URL) that they don't have access to view. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted December 2, 2013 Share Posted December 2, 2013 $page->selected_user <-- holding the assigned users as page reference. if( $user === $page->selected_user ) { echo "users own page"; } Link to comment Share on other sites More sharing options...
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