Skip to content

Commit 0a2fe1e

Browse files
authored
Merge pull request #653 from ProgressPlanner/filip/v19/prevent-enqueu
Dont enqueue scripts on WP Dashboard page for user who dont get our widgets
2 parents f67f3b2 + 0f7505c commit 0a2fe1e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

classes/suggested-tasks/providers/class-tasks-interactive.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ abstract public function print_popover_form_contents();
168168
* @return void
169169
*/
170170
public function enqueue_scripts( $hook ) {
171+
172+
// Don't enqueue the script if the user is not at least an editor, since we dont want to enqueue scripts on WP Dashboard page.
173+
if ( ! \current_user_can( 'edit_others_posts' ) ) {
174+
return;
175+
}
176+
171177
// Enqueue the script only on Progress Planner and WP dashboard pages.
172178
if ( 'toplevel_page_progress-planner' !== $hook && 'index.php' !== $hook ) {
173179
return;

0 commit comments

Comments
 (0)