I am trying to add custom actions, events and conditions to work with Rules interface. I began by adding custom actions by creating a custom module. Here's my code till now.
rules_example.info :
name = Rules Example
description = Test module to add new actions, events, and conditions
core = 7.x
rules_example.module :
<?php
/**
*/
rules_example.rules.inc :
<?php
/**
* @file
* Example rules module to create actions, events, and conditions
*/
/**
* Implement hook_rules_action_info()
* Declare any meta data about actions for Rules
*/
function rules_example_rules_action_info() {
$actions = array(
'rules_example_actions_hello_world' => array(
'label' => t('Print Hello World on the page'),
'group' => t('Rules Example'),
),
'rules_example_actions_hello_user' => array(
'label' => t('Print Hello to the logged in user'),
'group' => t('Rules Example'),
'parameter' => array(
'account' => array(
'type' => 'user',
'label' => t('User to say hello to'),
),
),
),
);
return $actions;
}
/**
* The action function for rules_example_action_hello_world
*/
function rules_example_action_hello_world() {
drupal_set_message(t('Hello World'));
}
/**
* The action function for rules_example_action_hello_user
*/
function rules_example_action_hello_user($account) {
drupal_set_message(t('Hello @username',
array('@username' => $account->name)));
}
Well, this is it. I have saved all these files in a folder rules_example in sites/all/modules. When i install the module or rather try to install it i get this error:
ReflectionException: Function rules_example_actions_hello_world() does not exist in ReflectionFunction->__construct() (line 1691 of /opt/lampp/htdocs/sites/all/modules/rules/includes/rules.core.inc)
I am not sure what the error is. I am going to rules.core.inc but am not able to understand what is causing the error. Thanks.