Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active December 16, 2015 20:19
Show Gist options
  • Save robneu/5492031 to your computer and use it in GitHub Desktop.
Save robneu/5492031 to your computer and use it in GitHub Desktop.
Modify the EDD settings page for non-super admin users.
<?php
/**
* EDD Super Admin Settings
*
* Modifies the EDD settings page for non-super admin users.
*
* @package EDSU_Admin
* @author FAT Media <[email protected]>
* @copyright Copyright (c) 2012, FAT Media
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0.0
*/
add_action('plugins_loaded','edsu_super_admin_check');
function edsu_super_admin_check() {
if ( ! is_super_admin() ) {
// Ensure all plugin filters are disabled for 'Gateways'
remove_all_filters( 'edd_settings_gateways', 10 );
// Display only necessary EDD settings for 'Gateways'
function edsu_replace_settings_gateway( $settings ) {
$settings = array(
'paypal_email' => array(
'id' => 'paypal_email',
'name' => __('PayPal Email', 'edd'),
'desc' => __('Enter your PayPal account\'s email', 'edd'),
'type' => 'text',
'size' => 'regular'
),
);
return $settings;
}
add_filter( 'edd_settings_gateways', 'edsu_replace_settings_gateway' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment