有沒有一個模塊可以在註冊時爲不同的角色製作不同的註冊表格? (。每前主編,主用戶,副用戶角色有不同的形式)如何在Drupal中製作不同的註冊表單?
1
A
回答
1
有:)
http://drupal.org/project/autoassignrole
通過路徑分配還需要內容簡介:
http://drupal.org/project/content_profile
退房本教程就如何把它關閉:
http://www.web-a-team.com/blog-post/user-registration-more-one-role
+0
我安裝了這個,但是如何創建不同的頁面? – MJH 2011-02-14 15:52:03
2
這裏是你應該做的
- 開始與安裝profile2-7.x-1.2.tar.gz。
- 實體7.x的-1.0-rc3.tar.gz一旦你安裝了PROFILE2 - >
- 啓用 - >點擊配置 - (這裏你可以看到你的個人資料類型 -add只要你想盡可能多的)。
當您添加一個新的或修改現有的「主」時,請確保您選中「提供單獨的頁面以編輯配置文件」。 4.現在有不同的註冊,登錄和密碼更改頁面 安裝並啓用profile2_regpath-7.x-1.9.tar.gz 現在再次訪問配置文件類型頁面,你應該看到「UNIQUE REGISTRATION PATH」.. rest is容易..
0
這裏有一些想法如何解決你的問題在Drupal 7(我認爲它應該在Drupal 6也工作)。但是它不是安全的,因爲任何人都可以只改變他們的作用:
function my_module_form_user_register_form_alter(&$form, &$form_state, $form_id) {
$company_role = $form_state['build_info']['args'][0];
$form['account']['company_role'] = array(
'#type' => 'select',
'#title' => t('Company role'),
'#options' => drupal_map_assoc(array('editor','main user','Sub User')),
'#description' => t('Please select your company role'),
"#empty_option" =>t('- Select -'),
'#weight' => -11, // Add the select box above username that have weight -10
);
switch (strtolower($company_role)) {
case 'editor':
// add extra fields for editor
$form['account']['company_role']['#default_value'] = $company_role;
break;
case 'main user':
// add extra fields for main
$form['account']['company_role']['#default_value'] = $company_role;
case 'sub user';
// add extra fields for 'Sub User'
$form['account']['company_role']['#default_value'] = $company_role;
break;
default:
$form['account']['company_role']['#empty_option'] = t('- Select -');
$company_role = null;// error handling or default case
}
}
比如你在你的公司的LDAP,你可以改爲從LDAP獲取(https://www.drupal.org/node/1053748)這一信息。那麼你可以更確定角色是否被正確選擇。
你怎麼知道用戶在註冊之前會有什麼作用? – mingos 2011-02-14 13:58:56
與url(例如reg/editor,reg/main,reg/sub) – MJH 2011-02-14 14:02:23