- Issue created by @gennadiy
Have D7 with Login Toboggan and Profile2 Registration Path and tried to populate email field unsuccessfully.
Decided to use workaround inside logintoboggan.module:
Find this code:
// Weight things properly so that the order is name, mail, conf_mail.
$form['account']['name']['#weight'] = -30;
$form['account']['mail']['#weight'] = -29;
}
and replace with:
// Weight things properly so that the order is name, mail, conf_mail.
$form['account']['name']['#weight'] = -30;
$form['account']['mail']['#weight'] = -29;
// parse query params to prepopulate email fields
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url_components = parse_url($url);
if (!empty($url_components['query'])){
parse_str($url_components['query'], $params);
}
$emailvalue = isset($params['email']) ? $params['email'] : "";
if ($emailvalue != "") {
$form['account']['mail']['#value'] = $emailvalue;
$form['account']['conf_mail']['#value'] = $emailvalue;
}
}
Usage: https://www.web.site/user/register?email=a@b.ca
Hope it would be helpful for someone. Thank you!
Active
2.0
Code