Hi all,
I allowed anonymous users to create a new node:
"node/add/nodetype"
the node contains 3 relevant fields:
field_your_email
field_your_name
field_recipient_mail
After the node is being saved, a mail is send to the person that created the node, being "field_your_email".
A mail is being send to the recipient using the field "field_recipient_mail".
After these mails are send a new action is invoked: create new entity, type: user.

---------
Create a new entity
Parameter: Entity type: User, Name: [node:field-your-name], Email: [node:field-your-email]
Provides variables: Created entity user (entity_created_user)
---------

The first 2 mails are being send without a problem.
In my account settings:
admin/config/people/accounts
I have the option: "Who can register accounts" set to: "visitors".
The option: "Require e-mail verification when a visitor creates an account." is enabled.

When my node is saved, a user account is created with the correct name and e-mail address, the status for this account is "blocked", no e-mail is send with the one time login link to enable the account.

Sending e-mail from my Drupal install is working fine.
When I create a new user from "user/register" the e-mail IS being send.

Only when i create a new user with a rule/action, the mail is not being send.

This is my showstopper from going live next monday, so any help is highly appreciated.
Many thanks, and have a great day/weekend!
Johan.

Comments

eileenmcnaughton’s picture

Hi - you might need to add some additional actions to get those things to happen - pretty sure there is an 'unblock user' action & one to send emails

mariusilie’s picture

After you create the user you need to add a value to the user object (Status = active ) like this:

Set a data value
Parameter: Data: [entity-created-user:status], Value: Active
chobart’s picture

This is because the action "create new entity" creates a new object that contains data

stdClass Object
(
     [is_new] => 1
     [name] => example name
     [mail] => example@email
     [status] => 1
)

but if I understand it, is not yet saved by user_save() and therefore does not have a uid etc.

Solution
1. create new component (action set) with two variables:
- new_node; data type: node; usage: parameter; (will be provided by our rule - this is newly created node from which we take the field name and email)
- created_user; data type: user; usage: provided;
2. add action to component "create a new entity"; this will add a variable, for example, test
3. add action to component "set a data value" (data:created_user; value:tmp_user)
4. create new rule
5. add action and select newly created component
6. the user will be truly created and you can use it through the variable "created_user". Sending e-mails or set the field values will work.

skek’s picture

The solution suggestion by @chobart works fine with me.

TR’s picture

Status: Active » Fixed

#4 indicates that the solution provide in #3 works. The original poster has not responded one way or another.

I think this can be considered as answered satisfactorily.

TR’s picture

Status: Fixed » Closed (fixed)