Created
April 24, 2012 22:19
-
-
Save adamkiss/2484276 to your computer and use it in GitHub Desktop.
ProcessWire user access 909 (uber-advanced)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//This just blew my mind | |
// | |
//User has field 'userPages'[Pagefield type], where administrator added parts of whole tree avail. to user. | |
//This checks whether current page (wrapped in object) or any of its parents was added to this 'userPages' | |
//(thus current page or anything higher in the hierarchy gives user the access) | |
//wow. | |
$access = | |
count( | |
Wire::getFuel('user')->userPages->find( | |
'id='.$this->page->parents() | |
->append($this->page) | |
) | |
) > 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment