Show Sign in with Google button when previewing page/post content, even when signed in #10301
Labels
Module: Sign in with Google
Sign in with Google (SiwG) related issues.
P2
Low priority
PHP
Team S
Issues for Squad 1
Bug Description
Currently, the Sign in with Google button Gutenberg block does not appear for users who are already signed in to their WordPress site.
But if you're previewing content, say from an edit page/post screen and then preview the draft content, the Sign in with Google button should appear, so you can preview how it would work in production.
Steps to reproduce
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
Update the following line to render the block if
is_preview()
even if the user is logged in, this will display the button on preview pages:site-kit-wp/includes/Modules/Sign_In_With_Google/Sign_In_With_Google_Block.php
Lines 85 to 87 in 00dee09
Update the
includes/Modules/Sign_In_With_Google.php
:is_preview()
:site-kit-wp/includes/Modules/Sign_In_With_Google.php
Line 503 in 00dee09
handleCredentialResponse
function in a PHP if statement that only outputs the function body ifis_preview()
isfalse
to ensure the button does nothing on the preview page if clicked.site-kit-wp/includes/Modules/Sign_In_With_Google.php
Lines 468 to 487 in 00dee09
is_preview()
is true.site-kit-wp/includes/Modules/Sign_In_With_Google.php
Line 517 in 00dee09
Test Coverage
is_preview()
returns true and confirm there are no regressions where the button is rendered in other contexts.QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: