Last active
June 28, 2018 07:04
-
-
Save wpweb101/0bdbb114a0aa6f6f740f to your computer and use it in GitHub Desktop.
Update vendor role title in woo pdf voucher
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 // Do not add this if it's already added. | |
| function woo_vou_change_vendor_role_name() { | |
| //get vendor role | |
| $vendor_role = get_role( WOO_VOU_VENDOR_ROLE ); | |
| if( !empty( $vendor_role ) ) { // if already added vendor role | |
| // first remove vendor role | |
| remove_role( WOO_VOU_VENDOR_ROLE ); | |
| // Now, add vendor role | |
| $capabilities = array( | |
| WOO_VOU_VENDOR_LEVEL => true, // true allows add vendor level | |
| 'read' => true | |
| ); | |
| add_role( WOO_VOU_VENDOR_ROLE, __( 'Gift Voucher Vendor', 'woovoucher' ), $capabilities ); | |
| //get vendor role | |
| $vendor_role = get_role( WOO_VOU_VENDOR_ROLE ); | |
| $vendor_role->add_cap( WOO_VOU_VENDOR_LEVEL ); | |
| } | |
| } | |
| add_action( 'init', 'woo_vou_change_vendor_role_name' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment