This Filter can be used to prepare array of custom access rule records to display in admin side access rule grid.
Hook Name: arm_prepare_custom_rule_data
Hook Type: Filter
Source: core/classes/class.arm_access_rules.php
Usage:
add_filter( 'arm_prepare_custom_rule_data', 'your_function', 10, 2);
function your_function($rule_records, $args) {
//$rule_records Array of access rule items.
//$args Array of filter arguments for grid listing
global $arm_access_rules;
if ($args['slug'] == 'custom_rule') {
$dbrules = $arm_access_rules->arm_get_custom_access_rules('custom_rule');
$protection = (!empty($dbrules['custom_item']['protection'])) ? $dbrules['custom_item']['protection'] : '0';
$plans = (!empty($dbrules['custom_item']['plans'])) ? $dbrules['custom_item']['plans'] : array();
$rule_records['custom_item'] = array(
'id' => 'custom_item',
'title' => 'Custom Item',
'description' => 'This is Custom Item',
'protection' => $protection,
'plans' => $plans,
);
}
return $rule_records;
}
Parameters:
$rule_records
Array of access rule items
$args
Array of filter arguments for grid listing