Drupal 6 使用Drupal6规则模块按id加载内容

Drupal 6 使用Drupal6规则模块按id加载内容,drupal-6,Drupal 6,希望根据某些条件(基本上只是在创建新帐户时)向Drupal6用户的帐户添加文件。我想使用规则模块来实现这一点,但条件项似乎不包括此操作。如果您选择“执行自定义PHP代码”,可能是可行的,但这超出了我的编程范围。欢迎任何想法。嗯,好吧,也许你会发现创建一个新模块很困难,但很容易。让我们来做吧 1-转到/站点/所有/模块 2-创建名为when_user_login的新文件夹(让我们在when_user_login时调用新模块) 3-在\u user\u login.info包含以下代码时在此文件夹内

希望根据某些条件(基本上只是在创建新帐户时)向Drupal6用户的帐户添加文件。我想使用规则模块来实现这一点,但条件项似乎不包括此操作。如果您选择“执行自定义PHP代码”,可能是可行的,但这超出了我的编程范围。欢迎任何想法。

嗯,好吧,也许你会发现创建一个新模块很困难,但很容易。让我们来做吧

1-转到/站点/所有/模块

2-创建名为when_user_login的新文件夹(让我们在when_user_login时调用新模块)

3-在\u user\u login.info包含以下代码时在此文件夹内创建

name = when user login 
description = this module do something when user login
core = 6.x
/**
* Implementation of hook_user().
* @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_user/6
* for more details
*/    

function when_user_login_user($op, &$edit, &$account, $category = NULL) {
switch($op){
  case 'insert' : 
  // now any code we will write here will be implemented when new user register
  // you can access the new user information by {$account} variable
  // E.g $account->uid include the id of the new account that register


  break ; 
}
}
4-现在让我们在同一目录中创建一个新文件,名为when\u user\u login.module,包括以下代码

name = when user login 
description = this module do something when user login
core = 6.x
/**
* Implementation of hook_user().
* @see http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_user/6
* for more details
*/    

function when_user_login_user($op, &$edit, &$account, $category = NULL) {
switch($op){
  case 'insert' : 
  // now any code we will write here will be implemented when new user register
  // you can access the new user information by {$account} variable
  // E.g $account->uid include the id of the new account that register


  break ; 
}
}

祝你好运…这将帮助你(别忘了启用该模块)

你可以在case'insert'之后编写php代码。。。如果你没有php编码的经验…让我知道你想做什么后,新的帐户创建…也许我可以帮助uThanks在这方面,我感谢你的帮助,这是很容易遵循!