Custom rule event trigger, action

Error message

  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 818 of /home/xenyomed/public_html/sites/all/modules/libraries/libraries.module).
  • Deprecated function: Function create_function() is deprecated in GeSHi->_optimize_regexp_list_tokens_to_string() (line 4736 of /home/xenyomed/public_html/sites/all/libraries/geshi/geshi.php).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_required has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_optional has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 579 of /home/xenyomed/public_html/includes/menu.inc).

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com.

function recurly_account_save () {
..............
rules_invoke_event('recurly_account_save',$recurly_account);
}
 
/* define event trigger */ 
function modulename_rules_event_info() {
  return array(
    'recurly_account_save' => array(
      'label' => t('update role'),
      'variables' => array(
        'user' => array(
          'type' => 'array',  // can be define as text, array, user , integer ....
          'label' => t('user'),
        ),
      ),
    ),
  );
}
 
/* define action */ 
function modulename_rules_action_info() {
    $actions['modulename_getresult'] = array(
      'label' => t('update role'),
      'parameter' => array(
        'user' => array(
          'type' => 'array',
          'label' => t('user'),
        ),
      ),
    );
   return $actions;
}
 
function modulename_getresult($account) {
  //$account is the variable passed in from event trigger
 //do your logic here
}
Help Share this Article