Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSO: Implement users table user invite revoking [Original] #35272

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
640f172
Implement users table improvements
alshakero Jan 22, 2024
6d444bf
changelog
alshakero Jan 22, 2024
a80b54d
progress
alshakero Jan 23, 2024
cbbf0e6
Wire up invite action and status
alshakero Jan 24, 2024
05cedfa
Fix typo
alshakero Jan 24, 2024
62b7858
Get rid of ajax
alshakero Jan 25, 2024
e60cb44
Code clean up
alshakero Jan 25, 2024
19c8fba
Rename function
alshakero Jan 25, 2024
eeb7f6c
Better escaping
alshakero Jan 25, 2024
4d95b96
Merge branch 'trunk' into implement/users-table-improvements
alshakero Jan 25, 2024
e0a2a02
Leverage the original form
alshakero Jan 25, 2024
6a6783c
More granular error reporting
alshakero Jan 25, 2024
2f3eb00
Use wrapper function to retrieve current screen object
agrullon95 Jan 25, 2024
5952009
Fix whitespace for sso_reminder_logout_wpcom translators comment
agrullon95 Jan 25, 2024
be765eb
Simplify table styling logic
agrullon95 Jan 25, 2024
648e6ca
Merge branch 'trunk' into implement/users-table-improvements
agrullon95 Jan 26, 2024
93a437b
Change ajax_referer check to admin_referer check
agrullon95 Jan 26, 2024
6344432
Update admin notice text for successful invitation
agrullon95 Jan 26, 2024
28223aa
Check if current user has create_user capabilities
agrullon95 Jan 26, 2024
9d97df1
Simpilfy error notice logic
agrullon95 Jan 26, 2024
8dbe8a2
Add users.php changes to revoke user invites
agrullon95 Jan 26, 2024
3332c86
Remove unnecessary default case for invite revoke error handling
agrullon95 Jan 26, 2024
dd713df
Update capability check to promote_users
agrullon95 Jan 26, 2024
b8b9b5b
Check user / email error before checking for pending invite error
agrullon95 Jan 26, 2024
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
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/y
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

SSO: improve messaging and account binding between local and wp.com users
65 changes: 0 additions & 65 deletions projects/plugins/jetpack/class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

use Automattic\Jetpack\Assets;
use Automattic\Jetpack\Assets\Logo as Jetpack_Logo;
use Automattic\Jetpack\Boost_Speed_Score\Speed_Score;
use Automattic\Jetpack\Config;
use Automattic\Jetpack\Connection\Client;
Expand Down Expand Up @@ -3360,11 +3359,6 @@ public function admin_init() {
// Artificially throw errors in certain specific cases during plugin activation.
add_action( 'activate_plugin', array( $this, 'throw_error_on_activate_plugin' ) );
}

// Add custom column in wp-admin/users.php to show whether user is linked.
add_filter( 'manage_users_columns', array( $this, 'jetpack_icon_user_connected' ) );
add_action( 'manage_users_custom_column', array( $this, 'jetpack_show_user_connected_icon' ), 10, 3 );
add_action( 'admin_print_styles', array( $this, 'jetpack_user_col_style' ) );
}

/**
Expand Down Expand Up @@ -6450,65 +6444,6 @@ public function get_user_option_meta_box_order_dashboard( $sorted ) {

return $sorted;
}

/**
* Adds a "blank" column in the user admin table to display indication of user connection.
*
* @param array $columns User list table columns.
*
* @return array
*/
public function jetpack_icon_user_connected( $columns ) {
$columns['user_jetpack'] = '';
return $columns;
}

/**
* Show Jetpack icon if the user is linked.
*
* @param string $val HTML for the icon.
* @param string $col User list table column.
* @param int $user_id User ID.
*
* @return string
*/
public function jetpack_show_user_connected_icon( $val, $col, $user_id ) {
if ( 'user_jetpack' === $col && self::connection()->is_user_connected( $user_id ) ) {
$jetpack_logo = new Jetpack_Logo();
$emblem_html = sprintf(
'<a title="%1$s" class="jp-emblem-user-admin">%2$s</a>',
esc_attr__( 'This user is linked and ready to fly with Jetpack.', 'jetpack' ),
$jetpack_logo->get_jp_emblem()
);
return $emblem_html;
}

return $val;
}

/**
* Style the Jetpack user column
*/
public function jetpack_user_col_style() {
global $current_screen;
if ( ! empty( $current_screen->base ) && 'users' === $current_screen->base ) {
?>
<style>
.fixed .column-user_jetpack {
width: 21px;
}
.jp-emblem-user-admin svg {
width: 20px;
height: 20px;
}
.jp-emblem-user-admin path {
fill: #069e08;
}
</style>
<?php
}
}

/**
* Checks if Akismet is active and working.
*
Expand Down
Loading
Loading