【问题标题】:How to create node of particular content type from webform results?如何从网络表单结果创建特定内容类型的节点?
【发布时间】:2012-10-24 06:55:37
【问题描述】:

是否可以配置网络表单以根据提交的数据创建特定内容类型的节点?假设来自网络表单的字段将直接匹配内容类型上的字段。

【问题讨论】:

  • 你是在问是否有人知道如何创建一个与 webform 提交具有相同值的节点?
  • 是的,我需要帮助来创建网络表单提交结果的节点。
  • 我不相信有一种自动或简单的方法可以做到这一点。规则模块和令牌可能有可能,或者自定义模块肯定有可能。

标签: drupal-6 webforms drupal-7 content-type


【解决方案1】:
//Declare a new StdObj
$node = new StdObj();

//Set the type
$node->type='your_content_type';

//Set the Title
$node->title='title';

//Set the body
$node->body = 'body';

//Set other content fields
$node->field_name[0]['value'];

//Finally use functions to save, submit, and insert the node
$node = node_save($node);
node_submit($node);
content_insert($node);

【讨论】:

    【解决方案2】:

    创建与网络表单具有相同字段的内容类型,并授予匿名用户创建该内容类型节点的权限。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-04
      • 1970-01-01
      • 1970-01-01
      • 2017-10-14
      相关资源
      最近更新 更多