Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e002e33
First commit
spacedmonkey May 12, 2020
3346643
Merge branch 'master' into fix/themes-api
spacedmonkey Jun 9, 2020
d363522
Add statuses.
spacedmonkey Jun 9, 2020
04d2fc3
Add tests
spacedmonkey Jun 17, 2020
a1fc463
Fix tests.
spacedmonkey Jun 17, 2020
c8af5d2
Fix tests.
spacedmonkey Jun 17, 2020
1597413
Merge branch 'master' into fix/themes-api
spacedmonkey Jun 17, 2020
9bc53c9
Remove allowed.
spacedmonkey Jun 18, 2020
5cf33f7
Make the logic much simplier.
spacedmonkey Jun 18, 2020
accee13
Improve tests.
spacedmonkey Jun 22, 2020
20e9a1e
Fix linting.
spacedmonkey Jun 22, 2020
93fa7ce
Merge branch 'master' into fix/themes-api
spacedmonkey Jun 26, 2020
a02f03f
Add single theme api.
spacedmonkey Jun 26, 2020
69e872f
Fix lints.
spacedmonkey Jun 26, 2020
caec2fa
Add single tests.
spacedmonkey Jun 26, 2020
f302af4
Fix lint
spacedmonkey Jun 26, 2020
e334704
Fix unit tests.
spacedmonkey Jun 28, 2020
14ab4a3
Merge branch 'master' into fix/themes-api
spacedmonkey Jul 1, 2020
2d1cc0e
Allow reading current theme.
spacedmonkey Jul 2, 2020
0847a4c
Tweak permission checks.
spacedmonkey Jul 2, 2020
91076c7
Fix unit tests.
spacedmonkey Jul 2, 2020
640bf1f
Change method name.
spacedmonkey Jul 3, 2020
4e838b4
Merge remote-tracking branch 'remotes/origin/master' into fix/themes-api
TimothyBJacobs Jul 5, 2020
b9293ca
Merged master and resolved conflicts
Oct 19, 2020
e19cf17
Address PR feedback
Oct 19, 2020
3e5b894
Fix test
Oct 19, 2020
e1ff816
Restore theme status check for theme_supports field data
Oct 20, 2020
e06a1b7
Fix CI feedback - short array syntax is not allowed
Oct 20, 2020
c308345
Merge branch 'master' into fix/themes-api
Oct 20, 2020
f9cf70c
Merge pull request #1 from spacedmonkey/fix/themes-api-enhancements
spacedmonkey Oct 21, 2020
c2855ea
Address PR feedback and add active theme link to WP_REST_Server::get_…
Oct 22, 2020
c617a05
Address PR feedback, fix version updates, fix active theme link names…
Oct 22, 2020
7c0c870
Fixed docblocks versions
Oct 22, 2020
b025e17
Fixed docblocks versions
Oct 22, 2020
e418d97
Remove the logic to fill theme_supports for inactive themes
Oct 23, 2020
142c78e
Fix tests
Oct 23, 2020
138f9eb
Merged master and resolved conflicts
Dec 4, 2020
bb14aba
Merge branch 'fix/themes-api' of github.com:spacedmonkey/wordpress-de…
TimothyBJacobs Jan 2, 2021
458c271
Merge branch 'master' into fix/themes-api
TimothyBJacobs Jan 2, 2021
278a9b9
Miscellaneous fixes and adjustments.
TimothyBJacobs Jan 3, 2021
d672a7b
Also allow users with just switch_themes or manage_network_themes to …
TimothyBJacobs Jan 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove allowed.
  • Loading branch information
spacedmonkey committed Jun 18, 2020
commit 9bc53c9e4c7069753b607ad8f7d67ced5cbcd795
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ public function get_items_permissions_check( $request ) {
}
}

if ( 'site' === $request['allowed'] && current_user_can( 'switch_themes' ) ) {
return true;
}

if ( is_multisite() && 'network' === $request['allowed'] && current_user_can( 'manage_network_themes' ) ) {
if ( current_user_can( 'switch_themes' ) || current_user_can( 'manage_network_themes' ) ) {
return true;
}

Expand Down Expand Up @@ -105,7 +101,7 @@ public function get_items( $request ) {
$active_theme = $this->prepare_item_for_response( $active_theme, $request );
$themes[] = $this->prepare_response_for_collection( $active_theme );
} else {
$active_themes = wp_get_themes( array( 'allowed' => $request['allowed'] ) );
$active_themes = wp_get_themes();
foreach ( $active_themes as $theme_name => $theme ) {
if ( $this->is_current_theme( $theme, $active_theme ) ) {
continue;
Expand All @@ -115,7 +111,7 @@ public function get_items( $request ) {
}
}
} else {
$active_themes = wp_get_themes( array( 'allowed' => $request['allowed'] ) );
$active_themes = wp_get_themes();
foreach ( $active_themes as $theme_name => $theme ) {
$_theme = $this->prepare_item_for_response( $theme, $request );
$themes[] = $this->prepare_response_for_collection( $_theme );
Expand Down Expand Up @@ -724,13 +720,6 @@ public function get_collection_params() {
'sanitize_callback' => array( $this, 'sanitize_theme_status' ),
);

$query_params['allowed'] = array(
'description' => __( 'Allowed.' ),
'type' => 'string',
'enum' => array( 'network', 'site' ),
'default' => 'site',
);

/**
* Filter collection parameters for the themes controller.
*
Expand Down