Last active
August 29, 2015 14:17
-
-
Save robcolburn/929322ace8086dd06a2a to your computer and use it in GitHub Desktop.
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
<? | |
/** | |
* Determine if user can access invoice. | |
* @param WP_Post $invoice | |
* The invoice to check. | |
* @return boolean | |
* TRUE if user can access invoice. | |
*/ | |
function can_access_invoice ($invoice) { | |
global $current_user; | |
if ($current_user->can_edit("posts")) { | |
return TRUE; | |
} | |
$classifications = wp_get_metadata(…); | |
if (!empty($classifications) && in_array($classifications, $user->classification)) { | |
return TRUE; | |
} | |
$email = wp_get_metadata(…); | |
if (!empty($email) && $email == $current_user->email) { | |
return TRUE; | |
} | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment