Created
March 4, 2020 11:47
-
-
Save wpweb101/58bc9c074eb2b6b0cead5529845dd9d8 to your computer and use it in GitHub Desktop.
WooCommerce Pdf Vouchers - code to identify current login user role is voucher vendor
This file contains hidden or 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 | |
| global $current_user, $woo_vou_vendor_role; | |
| //Current user role | |
| $user_roles = isset( $current_user->roles ) ? $current_user->roles : array(); | |
| $user_role = array_shift( $user_roles ); | |
| if( in_array( $user_role, $woo_vou_vendor_role ) ) { // Check current user is voucher vendor role | |
| // perform your action | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment