-
-
Save wpsmith/9129496 to your computer and use it in GitHub Desktop.
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
| add_filter( 'edd_enabled_payment_gateways', 'kws_edd_enabled_payment_gateways'); | |
| /** | |
| * Modify the gateways for users who can manage options so that the Test Payment gateway is activated. | |
| * See /easy-digital-downloads/includes/gateways/functions.php | |
| * @see edd_get_enabled_payment_gateways() | |
| * @param array $gateways Existing activated gateways array | |
| * @return array Modified array | |
| */ | |
| function kws_edd_enabled_payment_gateways($gateway_list) { | |
| global $edd_options,$current_user; | |
| // Is the current user admin? | |
| if(current_user_can( 'manage_options' )) { | |
| $gateway_list['manual'] = array( | |
| 'admin_label' => __( 'Test Payment (Admin-Only)', 'edd' ), | |
| 'checkout_label' => __( 'Test Payment (Admin-Only)', 'edd' ) | |
| ); | |
| } | |
| // If the current user's not admin, remove the Test Payment option | |
| else { | |
| unset($gateway_list['manual']); | |
| } | |
| return $gateway_list; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment