Skip to content

Introduce the ability to switch users from the Command Palette - #277

Merged
johnbillion merged 10 commits into
developfrom
command-palette
May 24, 2026
Merged

Introduce the ability to switch users from the Command Palette#277
johnbillion merged 10 commits into
developfrom
command-palette

Conversation

@johnbillion

Copy link
Copy Markdown
Owner

No description provided.

@johnbillion johnbillion added this to the 1.12.0 milestone May 24, 2026
@johnbillion
johnbillion marked this pull request as ready for review May 24, 2026 13:51
@johnbillion
johnbillion requested a review from Copilot May 24, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Command Palette integration so users can search for and switch into another account, switch back, or switch off directly from the WordPress Command Palette. The integration is implemented by registering a new REST field that exposes a switch-to URL per user, enqueueing a new browser script that registers static commands (switch back / switch off) and a dynamic command loader (switch to user) against wp.commands.store, and updating documentation and PHPCS config.

Changes:

  • Register user_switching_url REST field on the user object, gated by current_user_can( 'switch_to_user', $user_id ).
  • Enqueue and localize a new js/command-palette.js from admin_enqueue_scripts that wires switch back, switch off, and a debounced user search into the Command Palette.
  • Update the README FAQ to describe Command Palette support and restrict PHPCS scanning to .php files.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
user-switching.php Adds action_rest_api_init (REST field) and action_enqueue_command_palette_script hooks plus their hook registrations.
js/command-palette.js New script registering switch-back/off commands and a dynamic user-search command loader.
readme.txt Replaces the third-party admin-bar add-on FAQ with a Command Palette description.
phpcs.xml.dist Restricts PHPCS scanning to PHP files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/command-palette.js
Comment thread user-switching.php
Comment thread readme.txt Outdated
@johnbillion
johnbillion merged commit 0eb4a0f into develop May 24, 2026
40 checks passed
@johnbillion
johnbillion deleted the command-palette branch May 24, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants