Render alternative content if user is logged in instead of redirecting to user/uid
function custom_render_register_profile() {
global $user;
global $base_url;
$uid=$user-&gt;uid;
if($uid)
{
drupal_goto('url where you want to take login user..like $base_url./node/1');
}
else
{
  $user_register_form = drupal_get_form('user_registration_form');
  $markup =drupal_render($user_register_form);
  $output = array( '#markup' =&gt; $markup);
  return $output;
}
}