【问题标题】:Drupal Rules sending an email address to a user referenceDrupal 规则向用户参考发送电子邮件地址
【发布时间】:2010-12-16 16:30:30
【问题描述】:

我有一个自定义节点。它拥有的字段之一是用户参考。我希望在更新节点时向该引用的该用户发送电子邮件。我正在尝试使用规则模块来做到这一点。我可以从令牌中获取 uid,但不能获取邮件地址。

有什么方法可以从 to 字段和正文中执行一些 php。我的 php 被读取为文本。

我正在使用发送到任意电子邮件地址。

【问题讨论】:

    标签: drupal drupal-6


    【解决方案1】:

    使用user_load函数加载用户的对象,然后指定邮件地址。

    // Change $node->field_userreference to point to the correct CCK field    
    $recipient = user_load($node->field_userreference);
    return $recipient->mail;
    

    【讨论】:

    • @Will:你必须把它包装在
    • 这是正确的方法,但我认为您通常需要添加完整的数组(即$node->field_userrreference['0']['uid'])。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-18
    • 1970-01-01
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-04
    相关资源
    最近更新 更多