Drupal 7 Drupal 7:实体注册模块:默认或以编程方式启用注册
默认情况下,实体注册模块禁用注册。我们需要在每次从“管理注册-设置”选项卡创建节点时启用它。如何使过程自动化 我尝试将registration.field.inc的registration\u field\u info()中的“status”值更改为“1”,但没有成功 有没有一种方法可以通过编程实现呢Drupal 7 Drupal 7:实体注册模块:默认或以编程方式启用注册,drupal-7,registration,Drupal 7,Registration,默认情况下,实体注册模块禁用注册。我们需要在每次从“管理注册-设置”选项卡创建节点时启用它。如何使过程自动化 我尝试将registration.field.inc的registration\u field\u info()中的“status”值更改为“1”,但没有成功 有没有一种方法可以通过编程实现呢 /** * Implements hook_entity_insert(). */ function registration_entity_insert($entity, $entity_typ
/**
* 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);
}
}
参考资料: