Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mircobabini/4e25999f9035e1046fe8c04186551f7e to your computer and use it in GitHub Desktop.
Save mircobabini/4e25999f9035e1046fe8c04186551f7e to your computer and use it in GitHub Desktop.
<?php
/**
* Grant access to the back-end to certain user roles
*
* @param bool $prevent_admin_access
*
* @return bool
*/
function pmpro_grant_admin_access_to_dataanalyst( $prevent_admin_access ) {
if ( current_user_can( 'dataanalyst' ) ) {
$prevent_admin_access = false;
}
return $prevent_admin_access;
}
add_filter( 'pmpro_block_dashboard', 'pmpro_grant_admin_access_to_dataanalyst' );
add_filter( 'woocommerce_prevent_admin_access', 'pmpro_grant_admin_access_to_dataanalyst' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment