Hi,

first thank you very much for this module. I think this might not be a problem of your module as it seems to me that it is a problem in general: Content profile fields are offered as general tokens but they do not work in the first email. For example: I have one field for the first name and one field for the last name in a content profile which is used for registration. When I want to say "Hello Anton Baker" and use the tokens like
Hello [content-profile-benutzerdaten2-bn_firstname-raw] [content-profile-benutzerdaten2-bn_lastname-raw],

they are just empty - the same with the not-raw tokens. This is really just an issue with the first confirmation mail users get after registration. Maybe the mail is sent before the content profile is save and the tokens are available or something like that??

Best,
Tobias

Comments

zany’s picture

Priority: Normal » Minor
Status: Active » Needs work

You are right, It's a question of handler order.
drupal_process_form() will use form_execute_handlers() to call the submit handlers. In my test case these are

                            [#submit] => Array
                                (
                                    [0] => user_register_submit
                                    [1] => content_profile_registration_user_register_submit
                                )

So content_profile_registration_user_register_submit() is called only after user_register_submit() is run.
And user_register_submit() is the one to call drupal_mail() which calls token_registration_mails_mail_alter().

I don't think it's a good idea to shuffle the submit handler order. But the form variables should be somewhere and could be patched into the token replacement code.

tobiberlin’s picture

Ok... I think I understand a little but - but as I am not a programmer I do not understand if there is any solution for this. How could it be found where the form variables are?

zany’s picture

Status: Needs work » Postponed

The mail handler doesn't have access to the form vars. We'd need a replacement for user_register_submit() that handles this special case. Logintoboggan implements such a replacement function, it could serve as a starting point.
This replacement then needs to run the token code somehow or fake this special case before going to the mail handler.

I'd like to see this implemented but I don't need it right now. So this needs contributed code or sponsoring.