我正在寫一個Drupal 6模塊,其中我的任務是根據從註冊組合中選擇註冊的用戶在我的站點上分配特定角色由內容配置文件字段形成。 (自動分配角色模塊並不適用於我,因爲我必須使用基於角色選擇的條件字段,並且我無法獲得這兩項工作。)基於Drupal 6中的註冊字段組合設置新用戶的角色
在我的模塊中我實現了hook_user(),但我不'因爲我無法在我的&編輯或&帳戶對象中看到配置文件字段的值,所以不知道如何根據字段值做出決定。
/**
* Implementation of hook_user().
*/
function mymodule_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'isnert':
$rolenames = user_roles();
// 6 : magical role
//profile_load_profile($account); // tried with and without this
var_dump($account);
//var_dump($edit);
if(true) { // the decision should be made here based on the combo!
$edit['roles'] += array('6' => $rolenames[6]);
}
break;
PS:如果您有任何建議,如何很好地記錄消息沒有遠程調試,請包括它變成你的雁:-)
謝謝,dpm()很酷! – jabal