Warning message

Newsletter category Drupal Developer newsletter format has not been set to HTML. There will be no statistics recorded for this newsletter.

Set user password using RULES

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

a) create user entity ($newuser)
b) set a rules variable $password (use PHP code to generate a random string)
c) 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.


$edit = array('pass' => $password,);
user_save($newuser, $edit);

By brad.curnow on Tue, 18/03/2014 - 12:50pm

Add comment

Log in or register to post comments
QR code for this page URL This page URL