【问题标题】:Drupal Rules/Taxonomy integration?Drupal 规则/分类集成?
【发布时间】:2013-04-07 00:40:54
【问题描述】:

我想知道是否有办法在 Drupal 7 的规则中添加/编辑/删除分类术语?我还没有找到任何方法来做到这一点。

用例:我正在尝试使用规则来维护某个角色的用户名(分类)词汇表,因此当用户的角色更新时,我会添加/删除他们的用户名。

【问题讨论】:

    标签: drupal drupal-7 taxonomy drupal-rules


    【解决方案1】:

    这就是我的做法:

    在规则界面中:

    1) 在事件部分,我会选择该选项 “更新现有用户帐户后”。

    2) 在条件部分,我会选择更新的角色。

    3) 在 Actions 部分,我将编写自己的 php 代码,因为我无法在此处更改用户名。

    我的 php 代码:

    根据规则,您需要使用函数 hook_rules_action_info()。我会把它放在一个文件 mymodulename.rules.inc 中以减少负载。

    /*
    * Implementation of the hook_rules_action_info() 
    * 
    */
    function customvishal_rules_action_info()
    {
     // Here You can check the db for the uid and change the username as what you want. 
     using the SELECT and INSERT commands. Let me know if this works for you or if you
     need further help.
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-02
      • 1970-01-01
      • 2013-11-27
      • 2016-05-05
      • 2014-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多