Remove 'woocommerce_lock_down_admin' option and use filter only instead
This commit is contained in:
parent
c4fe2927d7
commit
b397b37b3e
|
@ -159,7 +159,7 @@ class WC_Admin {
|
|||
public function prevent_admin_access() {
|
||||
$prevent_access = false;
|
||||
|
||||
if ( 'yes' === get_option( 'woocommerce_lock_down_admin', 'yes' ) && ! is_ajax() && basename( $_SERVER["SCRIPT_FILENAME"] ) !== 'admin-post.php' ) {
|
||||
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! is_ajax() && basename( $_SERVER["SCRIPT_FILENAME"] ) !== 'admin-post.php' ) {
|
||||
$has_cap = false;
|
||||
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
|
||||
|
||||
|
|
|
@ -17,14 +17,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
/**
|
||||
* Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from seeing the admin bar.
|
||||
*
|
||||
* Note: get_option( 'woocommerce_lock_down_admin', true ) is a deprecated option here for backwards compatibility. Defaults to true.
|
||||
*
|
||||
* @access public
|
||||
* @param bool $show_admin_bar
|
||||
* @return bool
|
||||
*/
|
||||
function wc_disable_admin_bar( $show_admin_bar ) {
|
||||
if ( apply_filters( 'woocommerce_disable_admin_bar', get_option( 'woocommerce_lock_down_admin', 'yes' ) === 'yes' ) && ! ( current_user_can( 'edit_posts' ) || current_user_can( 'manage_woocommerce' ) ) ) {
|
||||
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! ( current_user_can( 'edit_posts' ) || current_user_can( 'manage_woocommerce' ) ) ) {
|
||||
$show_admin_bar = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue