Skip to content

Fix: prepare v4.6.6#367

Merged
apinto-uc merged 2 commits intomasterfrom
v4.6.6
Mar 12, 2026
Merged

Fix: prepare v4.6.6#367
apinto-uc merged 2 commits intomasterfrom
v4.6.6

Conversation

@apinto-uc
Copy link
Collaborator

@apinto-uc apinto-uc commented Mar 12, 2026

User description

Improvements

  • Improved tracking for PPG redirect — the redirect URL with tracking parameters is now available in all PPG page states, not only when the plugin is inactive

CodeAnt-AI Description

Preserve PPG redirect tracking across page states and during plugin activation

What Changed

  • The PPG redirect URL that includes the ppg_ref tracking parameter is now generated and passed to the PPG page view regardless of whether the linked plugin is active or not, so the tracking URL is always available in the UI.
  • During AJAX activation of the PPG plugin, the code removes the plugin's activation redirect transient to prevent the activation redirect from stripping the ppg_ref query parameter.
  • Plugin version constants and the readme were updated to 4.6.6 and include a short release note describing this change.

Impact

✅ Clearer PPG redirect tracking in all PPG page states
✅ Fewer lost ppg_ref tracking parameters when activating the PPG plugin
✅ Accurate plugin version and release notes for users

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link

codeant-ai bot commented Mar 12, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review
Copy link

Review Summary by Qodo

Version 4.6.6: Improve PPG redirect tracking availability

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Version bump to 4.6.6 across plugin files
• Improved PPG redirect tracking by making redirect URL available in all page states
• Fixed PPG activation redirect to preserve tracking parameters
• Moved redirect URL construction outside conditional block for consistent availability
Diagram
flowchart LR
  A["PPG Page Display"] --> B["Construct Redirect URL"]
  B --> C["Available in All States"]
  D["Plugin Activation"] --> E["Delete Activation Redirect Transient"]
  E --> F["Preserve ppg_ref Parameter"]
  C --> G["Enhanced Tracking"]
  F --> G
Loading

Grey Divider

File Changes

1. cookiebot.php ⚙️ Configuration changes +1/-1

Update main plugin version number

• Updated plugin version from 4.6.5 to 4.6.6

cookiebot.php


2. src/lib/Cookiebot_WP.php ⚙️ Configuration changes +1/-1

Update plugin version constant

• Updated COOKIEBOT_PLUGIN_VERSION constant from 4.6.5 to 4.6.6

src/lib/Cookiebot_WP.php


3. src/settings/pages/PPG_Page.php ✨ Enhancement +15/-11

Improve PPG redirect tracking availability

• Moved ppg_redirect_url construction outside the inactive plugin conditional to make it available
 in all page states
• Added deletion of ppguc_activation_redirect transient in ajax_activate_plugin() to prevent
 PPG's redirect from stripping the ppg_ref tracking parameter
• Updated template arguments array to include ppg_redirect_url for all page states

src/settings/pages/PPG_Page.php


View more (1)
4. readme.txt 📝 Documentation +11/-2

Update version and add changelog entry

• Updated stable tag version from 4.6.5 to 4.6.6
• Added changelog entry for version 4.6.6 with release date and improvement description
• Fixed BOM character in file header

readme.txt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 12, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Unused redirect URL arg 🐞 Bug ✓ Correctness
Description
PPG_Page::display() now always computes and passes $ppg_redirect_url into the view args, but the
rendered template doesn’t reference it, so this change has no runtime effect and the redirect URL
still isn’t surfaced by the PHP-rendered states.
Code

src/settings/pages/PPG_Page.php[R140-145]

  $args = array(
-			'hero_image'   => asset_url( 'img/ppg-hero.png' ),
-			'is_installed' => $is_installed,
-			'is_active'    => $is_active,
+			'hero_image'        => asset_url( 'img/ppg-hero.png' ),
+			'is_installed'      => $is_installed,
+			'is_active'         => $is_active,
+			'ppg_redirect_url'  => $ppg_redirect_url,
  );
Evidence
PPG_Page::display() injects 'ppg_redirect_url' into the view args via include_view(), but the
corresponding template only uses $is_active/$is_installed to render buttons and never reads
$ppg_redirect_url, so the new value is effectively dead/unconsumed in the rendered page.

src/settings/pages/PPG_Page.php[95-148]
src/view/admin/common/ppg-page.php[16-54]
src/lib/helper.php[523-538]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`PPG_Page::display()` now computes and passes `ppg_redirect_url` to the `admin/common/ppg-page.php` view, but the view never references it. This makes the new argument effectively dead code and does not surface the redirect URL in the PHP-rendered page states.
### Issue Context
The view is rendered via `include_view()` which `extract()`s args into local variables; unless the template uses `$ppg_redirect_url`, the value is never emitted.
### Fix Focus Areas
- src/settings/pages/PPG_Page.php[95-148]
- src/view/admin/common/ppg-page.php[16-54]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codeant-ai codeant-ai bot added the size:S This PR changes 10-29 lines, ignoring generated files label Mar 12, 2026
@codeant-ai
Copy link

codeant-ai bot commented Mar 12, 2026

Sequence Diagram

This PR ensures the tracked PPG redirect URL is generated for both active and inactive plugin states, so tracking is preserved consistently. It also clears the PPG activation redirect transient after activation to prevent loss of the tracking parameter.

sequenceDiagram
    participant Admin
    participant PPGPage
    participant UI
    participant Ajax
    participant WordPress
    participant PPGPlugin

    Admin->>PPGPage: Open PPG settings page
    PPGPage->>PPGPage: Build tracked redirect URL

    alt Plugin inactive
        PPGPage-->>UI: Render install activate UI with redirect URL
        UI->>Ajax: Request plugin activation
        Ajax->>WordPress: Activate PPG plugin
        WordPress->>PPGPlugin: Run activation
        WordPress->>WordPress: Clear activation redirect transient
        WordPress-->>UI: Activation success then use tracked redirect URL
    else Plugin active
        PPGPage-->>UI: Render page with tracked redirect URL
    end
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link

codeant-ai bot commented Mar 12, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Inconsistent Version
    A class-level constant COOKIEBOT_PLUGIN_VERSION ('4.6.6') was added but the file also defines/uses the global CYBOT_COOKIEBOT_VERSION (currently '1.0.0') in several places. This mismatch can lead to inconsistent version strings being used for enqueued scripts, cache-busting, telemetry or update checks. Decide on a single source of truth and update all usages accordingly.

  • Version Bump
    The plugin header Version was updated. Verify the version is also updated consistently in all release artifacts (readme, composer.json/package.json if present, changelog, and any constants used at runtime) to avoid mismatches between declared plugin header and programmatic version.

  • Release Process
    Updating the header alone does not complete a release. Confirm the release was tagged, changelog/release notes were updated, and CI/deployment steps (e.g. packaging or WordPress.org SVN if used) were executed so consumers see the new version and tracking fixes are deployed.

  • Redirect URL Generation
    The PR constructs $ppg_redirect_url with add_query_arg() and admin_url() even when not needed (computed before checking plugin active state). Also ensure the produced URL is properly sanitized/escaped when passed to JS and views to avoid potential injection issues.

@codeant-ai
Copy link

codeant-ai bot commented Mar 12, 2026

CodeAnt AI finished reviewing your PR.

@sonarqubecloud
Copy link

@apinto-uc apinto-uc merged commit c687b44 into master Mar 12, 2026
11 checks passed
@apinto-uc apinto-uc deleted the v4.6.6 branch March 12, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants