Skip to content

Conversation

@mchirag2002
Copy link
Contributor

@mchirag2002 mchirag2002 commented Oct 3, 2025

Description

  • This PR refactors the settings page of the plugin for the multisite installations only.
  • It makes the following changes:
    • Creates a new settings page for Network Admins
    • Moved the Client ID and Client Secret to the network level and removed them from subsites
    • Added option for applying settings globally, which, if enabled, makes the site-level settings Read-Only.
    • If not, then these settings like Onetap, Onetap locations, Create New Users, and Whitelisted domains need to be configured from the individual sites.

ToDo before making this release

  • Before releasing this feature, we need to make a minor release which adds an admin notice that informs the users about this upcoming refactoring, so that the small subset of people who use different credentials on their sites, don't upgrade or find a workaround.

Demo video for the changes implemented

https://drive.google.com/file/d/1UVpIxZGK58cSi3I7myc67eyPuBmZVzcO/view?usp=sharing

Fixes

Make the plugin multisite compatible (#119)

@mchirag2002 mchirag2002 added the enhancement New feature or request label Oct 3, 2025
@mi5t4n mi5t4n self-requested a review November 3, 2025 07:27
@mi5t4n
Copy link
Member

mi5t4n commented Nov 3, 2025

Will take over reviewing this PR.

cc @mchirag2002 @joelabreo227

@mi5t4n
Copy link
Member

mi5t4n commented Nov 6, 2025

@mchirag2002 Could you add screenshot or a video recording on what has changes where the new settings are ?

Copilot AI review requested due to automatic review settings November 6, 2025 12:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds multisite network support for the Google Login plugin, allowing network administrators to configure OAuth credentials and settings globally across all sites in a WordPress multisite installation.

Key Changes:

  • Adds network-level settings management for multisite installations
  • Implements get_client_id() and get_client_secret() methods to retrieve credentials from network settings in multisite environments
  • Adds an "Apply Globally" option to enforce network settings across all subsites

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
src/Modules/Settings.php Core changes implementing network settings registration, rendering, and saving functionality with UI toggle logic
src/Container.php Updates GoogleClient instantiation to use the new getter methods instead of direct property access
readme.txt Documents multisite configuration in the setup instructions
README.md Adds multisite setup documentation explaining the network administrator workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

'client_secret' => '',
];

$settings = $_POST['wp_google_login_network_settings'] ?? []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the phpcs:ignore comment indicates intentional access to unsanitized input, the array keys should be validated using wp_unslash() before processing. Consider wrapping $_POST['wp_google_login_network_settings'] with wp_unslash() to handle escaped input properly: $settings = isset( $_POST['wp_google_login_network_settings'] ) ? wp_unslash( $_POST['wp_google_login_network_settings'] ) : [];

Suggested change
$settings = $_POST['wp_google_login_network_settings'] ?? []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$settings = isset( $_POST['wp_google_login_network_settings'] ) ? wp_unslash( $_POST['wp_google_login_network_settings'] ) : []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

Copilot uses AI. Check for mistakes.
@mchirag2002
Copy link
Contributor Author

@mchirag2002 Could you add screenshot or a video recording on what has changes where the new settings are ?

@mi5t4n Updated the PR description to add the requested video.

Copy link
Member

@mi5t4n mi5t4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, but WP member setting must be set, otherwise just checking Create New User on Network side settings.

* Register the settings, section and fields.
* Retrieves the Google OAuth Client ID, always from the network settings in multisite.
*
* @return string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do add @since n.e.x.t and replace n.e.x.t with plugin version during release.

@mi5t4n mi5t4n self-requested a review November 7, 2025 11:53
mi5t4n

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants