Set user password using RULES

This CodeLet allows to set the user password during Rule execution, the following process can be used.

  1. create user entity ($newuser)
  2. set a rules variable $password (use PHP code to generate a random string)
  3. execute custom PHP which looks like

This way, you can also use the variable $password in say, an email to the user letting them know what their automatically generated password is.

Drupal Module hooks : Module file

We have discussed about the hooks to be used in .install file in Drupal module hooks: install file and in this discussion we will look at the hooks to be used in .module file. Remember, a Drupal module can have multiple .module files and each .module file has one accompanying .info file providing information about the module.