Can I generate a password for users using vbo?
I have created a rule that creates users upon condition but I want all this users to have the same password.

Can I do it with a vbo i create for that users?

Comments

bojanz’s picture

Category: task » support
Status: Active » Fixed

Using VBO execute the "Execute arbitrary PHP script" action on users, and in it enter the following code:

require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$entity->pass = user_hash_password('my_new_password');
user_save($entity);

You can also put that code in a custom action you write, of course.
Not sure if Rules has any code for handling passwords, so you'd have to create a feature request in their queue.
Rules could have a simple action that runs the value it gets through user_hash_password()....

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.