-
Notifications
You must be signed in to change notification settings - Fork 286
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
Update WP Consent API plugin detection to account for non-standard location #8307
Comments
AC ✔️, I have adjusted it a bit to add a note that the controller should use the right path to the plugin. |
IB ✅ |
QA Update ✅
|
@mohitwp as per my conversation on Slack. I am a little paranoid with this feature due to past issues 😄 so could you test the sceario in the QAB, but also check that the snippet still appears in the source code and ensure that tracking is working as expected for EU and Non EU traffic. More info on the snippet can be found in the testing instructions. Let me know if you have any questions. |
QA Update ✅
Recording.1161.mp4
|
|
I've created a follow-up PR. |
Thanks @nfmohit, this has been merged and tested so this is good to go 👍 It's worth noting that this issue's changes were somehow reverted (no longer in main or develop) in 9ab0412 after it had gone through QA, so the follow-up PR actually re-introduced the change while addressing the points I raised. |
Feature Description
As mentioned in this #8305 (comment), it's possible for the WP Consent API plugin entry point to reside in a location other than
wp-consent-api/wp-consent-api.php
.site-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 143 to 144 in b19bdd5
We should update the above code to account for alternative locations for the plugin.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
core/site/data/consent-mode
REST routeincludes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
:$slug
and$plugin
variables with a single new variable called$plugin_uri
with the value ofhttps://wordpress.org/plugins/wp-consent-api
. This is the URI of the plugin which won't change even if the plugin folder or main file changes.site-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 155 to 156 in cc356a6
$slug
and$plugin
variables as empty strings to set later based on dynamic plugin values.site-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 166 to 171 in cc356a6
get_plugins() as $plugin_file => $installed_plugin
.array_keys
function so that the loop gets the full plugin objects.$installed_plugin["PluginURI"] === $plugin_uri
.$slug
variable using$installed_plugin["TextDomain"]
.$plugin
variable using$plugin_file
.$slug
and$plugin
variables set based on the WordPress plugin data above, no changes required:site-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 177 to 184 in cc356a6
Test Coverage
QA Brief
wp-content/plugins/test-consent-plugin
Site Kit > Settings > Admin Settings
Consent Mode
, enable said featureActivate
CTA button shows as per the screenshot below:Site Kit > Settings > Admin Settings
, the Consent mode notice indicates the successful presence of the plugin as per the screenshot below:Site Kit > Settings > Admin Settings
Changelog entry
The text was updated successfully, but these errors were encountered: