开发者

Load content by id using Drupal6 Rules module

Would like to add files to a Drupal6 user's account based upon 开发者_StackOverflowcertain conditions (basically just upon new account creation). I want to use the Rules module to accomplish this but the conditional items don't seem to cover this action. Probably if you select the "Execute Custom PHP code" it is possible, but this out of my programming league. Any ideas welcome.


mmmm ok maybe u will find creating a new module is something difficult but its very easy..lets do it

1- go to /sites/all/modules

2- create new folder called when_user_login (lets called our new module when_user_login)

3- create inside this folder when_user_login.info include the following code

name = when user login 
description = this module do something when user login
core = 6.x

4- now lets create a new file in the same directory called when_user_login.module include the following code

/**
* 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 ; 
}
}

good luck...hop that will help you (don't forget to enable the module)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜