Skip to content

Commit

Permalink
SSO: optimize 'admin_notices' action callback (#39811)
Browse files Browse the repository at this point in the history
Make SSO admin class only hook into `admin_notices` when necessary.
  • Loading branch information
sergeymitr authored Oct 17, 2024
1 parent 8def970 commit 19fefdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

SSO: optimize 'admin_notices' action callback.
6 changes: 5 additions & 1 deletion projects/packages/connection/src/sso/class-user-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public function __construct() {
add_filter( 'manage_users_columns', array( $this, 'jetpack_user_connected_th' ) );
add_filter( 'manage_users_custom_column', array( $this, 'jetpack_show_connection_status' ), 10, 3 );
add_action( 'user_row_actions', array( $this, 'jetpack_user_table_row_actions' ), 10, 2 );
add_action( 'admin_notices', array( $this, 'handle_invitation_results' ) );

if ( isset( $_GET['jetpack-sso-invite-user'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
add_action( 'admin_notices', array( $this, 'handle_invitation_results' ) );
}

add_action( 'admin_post_jetpack_invite_user_to_wpcom', array( $this, 'invite_user_to_wpcom' ) );
add_action( 'admin_post_jetpack_revoke_invite_user_to_wpcom', array( $this, 'handle_request_revoke_invite' ) );
add_action( 'admin_post_jetpack_resend_invite_user_to_wpcom', array( $this, 'handle_request_resend_invite' ) );
Expand Down

0 comments on commit 19fefdd

Please sign in to comment.