Created
June 30, 2014 10:51
-
-
Save tjhole/85f6a86785fd0d2b13ac to your computer and use it in GitHub Desktop.
WORDPRESS: Google Analytics Bouncer
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
function lxb_google_analytic_dashboard_bouncer() { | |
//is the GAD plugin active in the first place? | |
if(is_plugin_active('google-analytics-dashboard/google-analytics-dashboard.php')) { | |
//get the current user | |
$current_user_id=get_current_user_id(); | |
//are you a super admin? if so, great | |
//remove the nav menu item for GAD page | |
$one = 'options-general.php'; | |
$two = 'google-analytics-dashboard/gad-admin-options.php'; | |
remove_submenu_page( $one , $two); | |
//thwart any attempts to access the page directly | |
if(isset($_GET['page'])){ | |
$p = $_GET['page']; | |
if ($p == 'google-analytics-dashboard/gad-admin-options.php'){ | |
wp_die('Insufficient permissions'); | |
} | |
} | |
} | |
} | |
add_action('admin_menu', 'lxb_google_analytic_dashboard_bouncer'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment