-
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
Conversation
includes/Helpers/Plugin.php
Outdated
@@ -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 ) { |
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.
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.
A couple of minor style/convention comments for @mr-vara
includes/Helpers/Plugin.php
Outdated
/** | ||
* 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 comment
The 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 <@var|@param|@return> <type> <$variable> <comment>
, and in the case of arrays, please include the array shape, i.e. in this case it's actually an array of arrays, but that is not communicated so far.
@return array<array{id:int, email:string}> $users Array of Admin & Super Admin users
includes/Helpers/Plugin.php
Outdated
* | ||
* @return $users Array of Admin & Super Admin users | ||
*/ | ||
private static function get_admin_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.
- We should generally prefer non-static functions. A couple of reasons (although not relevant here): they're easier to work with when testing and easier to work with when extending classes.
- Please include the return type
: array
Edit: I see now that all the other functions in this class are static
, so I guess you had to use static anyway!
This reverts commit 67f252a.
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.
Copilot reviewed 14 out of 14 changed files in this pull request and generated no suggestions.
Proposed changes
This pull request adds
users
data (array of administrator users for the WordPress site) data to Jetpack connected event.