I am developing a module for Drupal which provides a login form and after submission user cURL to login in with those credentials on another website.
If all goes well, the module redirects the user to their profile and should present the information cURL fetched. This is where things go wrong.
What I'm trying to do is get the $account
variable through the username. This is all in the module_name_form_submit
function:
$account = user_load(array('name' => check_plain($user)));
And then append the data I want to display to it:
$account->content['module_name'] = array(
'#title' => t('Module Title'),
'#values' => get_info()
);
If I do a print_r
before the redirect, sure enough, the data is there as it should. But after the redirect:
$form_state['redirect'] = "users/{$user}";
I no longer have access to that same data. So the question is, how can I set that variable in a permanent way and access it after the redirect in the user profile page? (I'm trying to avoid sessions).
$account = user_load(array('name' => check_plain($user)));
=> check_plain() should be used when displaying user submitted content. It is not necessary here as it does not protect against SQL-Injection. Instead, make sure to use proper placeholders when doing your own queries (user_load() does that..). – Berdir May 30 '11 at 6:12