Overriding Access Decisions #
Use the ghl_crm_should_deny_access filter to implement custom access control logic:
add_filter('ghl_crm_should_deny_access', function($deny, $post_id, $user_id) {
// Allow access to all editors regardless of tags
if (user_can($user_id, 'edit_posts')) {
return false;
}
// Custom business logic
if (my_custom_check($user_id, $post_id)) {
return false; // Allow access
}
return $deny;
}, 10, 3);
Customizing Denial Messages #
add_filter('ghl_crm_denial_page_content', function($content, $post_id) {
return '';
}, 10, 2);
Extending Effective Tags #
The ghl_user_effective_tags filter lets you inject additional tags into access control checks:
add_filter('ghl_user_effective_tags', function($tags, $user_id) {
// Add tags from another source
$extra = get_user_meta($user_id, 'my_extra_tags', true);
return array_merge($tags, (array)$extra);
}, 10, 2);
