function uc_file_ca_predicate in Ubercart 6.2
Implements hook_ca_predicate().
File
- uc_file/
uc_file.ca.inc, line 33 - This file contains the Conditional Actions hooks and functions necessary to make the file-related entity, conditions, events, and actions work.
Code
function uc_file_ca_predicate() {
// Renew all the files on an order when the status matches what's set in the files admin settings.
$configurations['uc_file_renewal'] = array(
'#title' => t('Renew purchased files'),
'#description' => t('Renew purchased files if the order status matches.'),
'#class' => 'renewal',
'#trigger' => 'uc_order_status_update',
'#status' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_order_status_condition',
'#title' => t('If the updated order status is payment received.'),
'#argument_map' => array(
'order' => 'updated_order',
),
'#settings' => array(
'order_status' => 'payment_received',
),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_file_order_renew',
'#title' => t('Update all file expirations for this order.'),
'#argument_map' => array(
'order' => 'updated_order',
),
),
),
);
$order_args = array(
'order' => 'order',
'expiration' => 'expiration',
);
// Notify the user when a file is granted.
$configurations['uc_file_notify_grant_trigger'] = array(
'#title' => t('Notify customer when a file is granted'),
'#description' => t('Notify the customer when they have had a file granted on their user.'),
'#class' => 'notification',
'#trigger' => 'uc_file_notify_grant',
'#status' => 1,
'#actions' => array(
array(
'#name' => 'uc_file_order_email',
'#title' => t('Send an e-mail to the customer'),
'#argument_map' => $order_args,
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email-raw]',
'subject' => t("File Downloads for Order# [order-id]"),
'message' => t("Your order (order# [order-link]) at [store-name] included file download(s). You may access them with the following link(s):\n\n[file-downloads]\n\nAfter downloading these files these links will have expired. If you need to download the files again, you can login at [site-login] and visit the \"My Account\" section of the site.\n\nThanks again, \n\n[store-name]\n[site-slogan]"),
'format' => 1,
),
),
),
);
return $configurations;
}