Send variable to the user profile in Drupal 6 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' =&gt; check_plain($user)));


And then append the data I want to display to it:

$account-&gt;content['module_name'] = array(
    '#title' =&gt; t('Module Title'),
    '#values' =&gt; 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).
PHP is a "shared-nothing" architecture, nothing persists over multiple requests unless stored externally.

So you really only have two options:


Sessions. Drupal already maintains a session for you for every user (also anon users, except on the first request). So just add your data to $_SESSION['yourmodule']['yourdata'] and you have it available on the next request where you can remove it again if you want.
GET. Alternatively, you can also pass the data forward through the GET request, by doing the redirect like this: $form_state['redirect'] = array('user/' . $account-&gt;uid, array('key' =&gt; 'value')). As in my example, you should always use the internal URL when doing a redirect, Drupal will take care of the aliasing fory you.