[英]Drupal 'Send Email' advanced action
I may be missing something blindingly obvious here (I hope so).....I am creating a module in Drupal 6 that consists of some triggers and actions. 我可能会在这里遗漏一些令人眼花(乱的东西(我希望如此).....我正在Drupal 6中创建一个包含一些触发器和动作的模块。 in it's simplest form it consists of:
最简单的形式包括:
I would like as much as possible to be managed through the triggers / actions interface in Drupal as the site admin is not a developer. 我希望尽可能通过Drupal中的触发器/操作界面进行管理,因为站点管理员不是开发人员。 The plan is to use the cron trigger to fire the action in 1. which will then fire a trigger for each user.
计划是使用cron触发器来触发1.中的操作,然后将为每个用户触发一个触发器。 The site admin will then be able to create a Send Email action through the actions interface and hook it up to the trigger from 2.
然后,站点管理员将能够通过操作界面创建“发送电子邮件”操作,并将其连接到2的触发器。
The part I can't get my head around is how the recipient of the email will be specified - the user trigger will be fired from an action run by cron (ie not in any user context) - how can I pass in a variable that can be used here? 我无法理解的部分是如何指定电子邮件的收件人-将由cron运行的操作(即,不在任何用户上下文中)触发用户触发器-如何传递变量可以在这里使用吗?
Thanks, 谢谢,
Triggers fire actions not the other way around. 触发火灾动作而不是相反。
The user that you pass to actions_do dosn't have to be the logged in user. 您传递给actions_do的用户不必是登录用户。 You can query for the users that you want to email and loop thrhough them doing user_load and then an actions_do
您可以查询要发送电子邮件的用户,并通过先执行user_load然后再执行action_do来循环
something like 就像是
foreach ($user_ids as $uid) {
$context_user = user_load(array('uid' => $uid));
$context = array(
'hook' => 'myhook',
'op' => $op,
'user' => $context_user,
);
actions_do(array_keys($aids), $context_user, $context);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.