Inicio - Documentación - POM Theme - 11 Developers - Evaluate POM permission rules

Evaluate POM permission rules

POM permission rules can combine role, purchase and subscription conditions. A rule decides whether its protected content should display; it does not replace WordPress capabilities for administrative actions.

List configured rules

$rules = pom_get_permission_rules();

Pass true to request the selector form with a default/empty option where supported:

$options = pom_get_permission_rules( true );

Treat the saved rule identifier as opaque. Do not parse the framework repeater structure in an integration.

Evaluate one rule

if ( class_exists( 'POM_Permission_Rules' ) ) {
    $permission = new POM_Permission_Rules( $rule_id );

    if ( $permission->display_content() ) {
        // Render the protected presentation.
    }
}

The evaluator supports the configured AND/OR relationship between subrules and current rules for:

  • current user role or absence of a role, including signed-out visitors;
  • purchased all/any, not purchased one or purchased none of selected products;
  • active qualifying subscriptions for all/any selected products;
  • configured purchase/subscription date conditions.

Unknown or malformed subrule types fail closed. A rule with no usable conditions leaves content visible.

Important boundary

display_content() answers a presentation/access-rule question. It does not grant edit_post, manage_options, order access or REST permission. Any state-changing endpoint still needs its own capability and nonce/authentication checks.

Purchase and subscription conditions require the corresponding WooCommerce functionality. Design a sensible fallback when the dependency is inactive.