Hi,

I successfully converted a 5x module to work with my drupal 6x site.. well, almost..

It's a tracking statistics module, for reinvigorate.. Everything works fine, it's tracking and all, except it's not outputting the Username in the tracking code..

/**
 * Implementation of hook_footer()
 */
function reinvigorate_tracker_footer($main = 0) {
  global $user;
  $code = variable_get('reinvigorate_tracker_tracking_id', FALSE);
  if ($code !== FALSE) {
    $output = '<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script><script type="text/javascript">';
    $output .= '//<![CDATA['."\n";
    if ($user->uid != 0) {
      $output .= 'var re_name_tag = "'. $user->name .'";';
      $output .= 'var re_context_tag = "'. url('user/'. $user->uid, NULL, NULL, TRUE) .'";';
    }
    $output .= 're_("'. $code .'");'."\n".'//]]></script>';
    return $output;
  }
}

The global $user seems to break the module completely.. but of course taking it out would cause it to never print the user name in the tracking code..

Where am I going wrong with my syntax?

Jon.

Comments

JonGirard-1’s picture

Found the problem, it's all fixed..