0

默认情况下,实体注册模块禁用注册。每次从“管理注册 - 设置”选项卡创建节点时,我们都需要启用它。如何使流程自动化?

我尝试在registration.field.inc 的registration_field_info() 中将“status”值更改为“1”,但没有成功。

有没有办法以编程方式进行,否则?

4

1 回答 1

1
/**
* Implements hook_entity_insert().
*/
function registration_entity_insert($entity, $entity_type) {
  $registration_type = registration_get_entity_registration_type($entity_type, $entity);
  if ($registration_type !== FALSE) {
list($entity_id) = entity_extract_ids($entity_type, $entity);

$settings2 = array(
  'multiple_registrations' => 0,
  'from address' => variable_get('site_mail', ini_get('sendmail_from')),
);

$settings = array(
  'status' => 1,
  'capacity' => 0,
  'send_reminder' => 0,
  'settings' => serialize($settings2),
);

registration_update_entity_settings($entity_type, $entity_id, $settings);
//registration_entity_set_default_settings($entity_type, $entity);
 }
}

参考:

http://drupal.org/node/1430870

http://drupal.org/node/1357280

于 2013-04-25T01:17:34.530 回答