2013-04-25 67 views
0

默認情況下,實體註冊模塊禁用註冊。我們需要在每次從「管理註冊 - 設置」選項卡創建節點時啓用它。如何實現流程自動化?Drupal 7:實體註冊模塊:默認或以編程方式啓用註冊

我試着將registration.field.info的registration_field_info()中的'status'值更改爲'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