Display node in user profile page I created a content type called successful story.

In user profile page user-profile.tpl.php, I have inserted a link to create a successful story

&lt;?php print l(t('Add a successful story'), "node/add/successful-story"); ?&gt;


For example, an user called user1 clicks on the link, and creates a successful story. 
I want to display the successful story the user created into their respective profile page

I add this code into template.php

&lt;?php

function mytheme_preprocess_page(&amp;$variables, $hook) {
  global $user;
  $uid = $user-&gt;uid;
  $nid = db_query("SELECT nid FROM {node} WHERE uid = :uid AND type = :type", array(":uid" =&gt; $uid, ":type" =&gt; 'successful story'))-&gt;fetchCol();
  $variables['ss_node'] = drupal_render(node_view(node_load($nid)));
}

?&gt;


Then I add this code into user-profile.tpl.php

&lt;?php

  global $user;
  $user_id = arg(1);

print $ss_node;

?&gt;


I hope I'm clear. Thanks for your help !
It won't be available directly in the template. First you should query the content created by that user and then pass it to template file using preprocess function. Finally render the node.

First to find the node created by the user 

$nid = db_query("SELECT nid FROM {node} WHERE uid = :uid AND type = :type", array(":uid" =&gt; $uid, ":type" =&gt; 'successful_story'))-&gt;fetchCol();


(Hope the user creates only one node or else you got to check it)

Then get the node content

$variables['ss_node'] = drupal_render(node_view(node_load($nid)));


The final code should be like

function template_preprocess_page(&amp;$variables, $hook) {
  global $user;
  $uid = $user-&gt;uid;
  $nid = db_query("SELECT nid FROM {node} WHERE uid = :uid AND type = :type", array(":uid" =&gt; $uid, ":type" =&gt; 'successful_story'))-&gt;fetchCol();
  $variables['ss_node'] = drupal_render(node_view(node_load($nid)));
}


Finally you can just print the $ss_node in user-profile.tpl.php