Connection Owner Deletion Notice: Fix display bug and sanitize $_REQUEST #14082
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Connection Owner Deletion notice should display when the connection owner is
about to be deleted, but it doesn't.
The notice is shown when the connection owner's id is found in the array of user ids that are about to be deleted. However, the arguments to
in_array()
are an integer and an array of strings, and thein_array()
call uses strict matching. Since the connection owner's id is never found in the array of ids that are about to be deleted, the notice doesn't display. Fix this by converting the user ids in the array from strings to integers.Changes proposed in this Pull Request:
$user_ids_to_delete
array to ints.Is this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
Install, activate, and connect Jetpack. The first connected user is the connection owner.
Create some users. At least one of these users must be an admin. So you'll have at least two admins: the connection owner and at least one secondary admin.
Log in as a secondary admin user.
Navigate to the Users page.
Verify that the Connection Owner Deletion notice displays when you attempt to delete the connection owner in different ways:
a) Hover over the user name and click Delete. Verify that the notice displays and go back to the Users page.
b) Check the box next to the connection owner’s user name, select the Delete action in the action dropdown box, and click Apply. Verify that the notice displays and go back to the Users page.
c) Select multiple users, including the connection owner. Select the Delete action, and click Apply. Verify that the notice displays and go back to the Users page.
The warning notice should not display if you aren’t deleting the connection owner, so test these cases with a user that isn't the connection owner:
a) Hover over the user name and click Delete. Verify that the notice does not display and go back to the Users page.
b) Check the box next to a user name, select the Delete action in the action dropdown box, and click Apply. Verify that the notice does not display and go back to the Users page.
c) Select multiple users (do not include the connection owner), select the Delete action, and click Apply. Verify that the notice does not display.
Proposed changelog entry for your changes: