-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add Admin user data to JetPack connected event #108
Changes from 5 commits
8b17c7c
5b792ee
5a08584
2401455
96afb63
80a3960
7143ee3
74d5a28
de93bed
1b79ec0
38d0ee8
0d2b3b6
0363f52
dd41adb
db8d438
263222f
038b60f
67f252a
0f89d2e
1af8eb2
3626318
d55aea7
d10b59b
6436c2b
dda58c8
85c4630
0db7084
5ec6f29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,10 @@ public static function get_data( $basename, $data, $mu = false ) { | |
$plugin['mu'] = $mu; | ||
$plugin['auto_updates'] = ( ! $mu && self::does_it_autoupdate( $basename ) ); | ||
|
||
if ( strpos( $basename, 'jetpack' ) !== false ) { | ||
$plugin['users'] = self::get_admin_users(); | ||
} | ||
|
||
return $plugin; | ||
} | ||
|
||
|
@@ -87,4 +91,29 @@ public static function does_it_autoupdate( $slug ) { | |
|
||
return in_array( $slug, $wp_auto_updates, true ); | ||
} | ||
|
||
/** | ||
* Get Admin and SuperAdmin user accounts | ||
* | ||
* @return $users Array of Admin & Super Admin users | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To correctly add the type here (so IDEs can understand it, and so people reading find it in the place it's typically expected), the format is
|
||
*/ | ||
private static function get_admin_users() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Edit: I see now that all the other functions in this class are |
||
// Get all admin users | ||
$admin_users = get_users( | ||
array( | ||
'role' => 'administrator', | ||
) | ||
); | ||
$users = array(); | ||
|
||
// Add administrators to the $users and check for super admin | ||
foreach ( $admin_users as $user ) { | ||
$users[] = array( | ||
'id' => $user->ID, | ||
'email' => $user->user_email, | ||
); | ||
} | ||
|
||
return $users; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this string match on other Jetpack plugins? Given that Jetpack has the main plugin and other standalone plugins, I'd imagine that maybe we should do an exact match.