Merge pull request #15542 from woocommerce/fix/15508

Use user_can function
This commit is contained in:
Claudiu Lodromanean 2017-06-09 09:29:50 -07:00 committed by GitHub
commit 8dc2b3dd86
1 changed files with 1 additions and 1 deletions

View File

@ -507,7 +507,7 @@ function wc_disable_author_archives_for_customers() {
if ( is_author() ) {
$user = get_user_by( 'id', $author );
if ( isset( $user->roles[0] ) && 'customer' === $user->roles[0] ) {
if ( user_can( $user, 'customer' ) && ! user_can( $user, 'edit_posts' ) ) {
wp_redirect( wc_get_page_permalink( 'shop' ) );
}
}