M_register_rule

The Membership 2 M register rule function.

Description

M_register_rule( (string) $rule_name, (string) $class_name, $section ); 

Parameters (3)

0. $rule_name (string)
The rule name.
1. $class_name (string)
The class name.
2. $section
The section.

Usage

  1. if ( !function_exists( 'M_register_rule' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/includes/functions.php'; 
  3.  
  4. // The rule name. 
  5. $rule_name = ''; 
  6.  
  7. // The class name. 
  8. $class_name = ''; 
  9.  
  10. // The section. 
  11. $section = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = M_register_rule($rule_name, $class_name, $section); 
  15.  

Defined (1)

The function is defined in the following location(s).

/app_old/membershipincludes/includes/functions.php  
  1. function M_register_rule($rule_name, $class_name, $section) { 
  2.  
  3. global $M_Rules, $M_SectionRules; 
  4.  
  5. if(!is_array($M_Rules)) { 
  6. $M_Rules = array(); 
  7.  
  8. if(!is_array($M_SectionRules)) { 
  9. $M_SectionRules = array(); 
  10.  
  11. if(class_exists($class_name)) { 
  12. $M_SectionRules[$section][$rule_name] = $class_name; 
  13. $M_Rules[$rule_name] = $class_name; 
  14. } else { 
  15. return false; 
  16.