Skip to content

Adds a way to bypass#28

Merged
jeawhanlee merged 11 commits intodevelopfrom
enhancement/add-bypass-possibility-to-check-capabilities
Nov 12, 2025
Merged

Adds a way to bypass#28
jeawhanlee merged 11 commits intodevelopfrom
enhancement/add-bypass-possibility-to-check-capabilities

Conversation

@Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Nov 10, 2025

Description

Fixes #x
Adds a way to bypass the current_user_can() check before sending tracking event.
Useful in a CRON context. where we are not runing the code with an admin user.

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

What was tested

Sending events from a CRON context in WP rocket

How to test

All process of WP Rocket - Rocket Inisghts

Technical description

Documentation

This pull request introduces a small but important change to the TrackingPlugin class to allow bypassing the capability check when tracking events. This provides more flexibility for tracking events under different conditions.

  • Tracking logic update: Added a bypass_capability boolean parameter to the track method in TrackingPlugin, which allows callers to skip the user capability check when tracking an event. [1] [2]

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

Difficult to tick everything to be honest

@Miraeld Miraeld requested review from a team and remyperona November 10, 2025 07:39
@Miraeld Miraeld self-assigned this Nov 10, 2025
Copilot AI review requested due to automatic review settings November 10, 2025 07:39
Copy link
Contributor

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 the ability to bypass capability checks when tracking events in Mixpanel by introducing a new optional $bypass_capability parameter to the track() method in the TrackingPlugin class.

Key Changes:

  • Added $bypass_capability boolean parameter (defaults to false) to the track() method signature
  • Modified the capability check logic to respect the bypass flag

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

@jeawhanlee jeawhanlee merged commit dfedab2 into develop Nov 12, 2025
3 checks passed
@jeawhanlee jeawhanlee deleted the enhancement/add-bypass-possibility-to-check-capabilities branch November 12, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants