Closed vaurdan closed 1 month ago
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Base branches to auto review (4)
* develop * add/.* * fix/.* * update/.*Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
We got reports that VIP support users were unable to access PCH features after the introduction of PCH permissions.
This PR gives a pathway to fix this. It introduces a new filter,
wp_parsely_current_user_can_use_pch_feature
, to thecurrent_user_can_use_pch_feature
function in theclass-permissions.php
file. This filter allows developers to override the default permissions check for specific Content Helper features.By using the filter, we'll now be able to grant PCH feature access to VIP support users.
The filter provides several parameters:
$current_user_can_use_pch_feature
(bool) to indicate whether the current user can use the feature$feature_name
(string) for the feature's name$current_user
(\WP_User) representing the current user object$post_id
(int|false) for the post ID if the check is for a specific post. If the filter returnstrue
, the function immediately grants permission, bypassing the default role-based check.This change allows more flexibility for customizing each feature permission based on specific requirements. Here's an example on how you could use to allow a specific role to have access to the Smart Linking feature.
Motivation and context
Improve the flexibility and extensibility of PCH access control.
How has this been tested?
Tested locally.