Skip to content

Commit 3be8d28

Browse files
authored
Merge pull request #690 from 10up/fix/645
Remove Subscriber from the list of allowed roles
2 parents 9f4ee48 + 201bba2 commit 3be8d28

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

includes/Classifai/Features/Feature.php

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public function setup_roles() {
7575
$this->roles = get_editable_roles() ?? [];
7676
$this->roles = array_combine( array_keys( $this->roles ), array_column( $this->roles, 'name' ) );
7777

78+
// Remove subscriber from the list of roles.
79+
unset( $this->roles['subscriber'] );
80+
7881
/**
7982
* Filter the allowed WordPress roles for a feature.
8083
*

tests/cypress/integration/admin/common-feature-fields.test.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ describe('Common Feature Fields', () => {
1818
feature_pdf_to_text_generation: 'PDF Text Extraction',
1919
};
2020

21-
const allowedRoles = [
22-
'administrator',
23-
'editor',
24-
'author',
25-
'contributor',
26-
'subscriber',
27-
];
21+
const allowedRoles = [ 'administrator', 'editor', 'author', 'contributor' ];
2822

2923
Object.keys( features ).forEach( ( feature ) => {
3024
it( `"${ features[ feature ] }" feature common fields`, () => {
@@ -51,7 +45,7 @@ describe('Common Feature Fields', () => {
5145
for ( const role of allowedRoles ) {
5246
if (
5347
'feature_image_generation' === feature &&
54-
( 'contributor' === role || 'subscriber' === role )
48+
'contributor' === role
5549
) {
5650
continue;
5751
}

0 commit comments

Comments
 (0)