Need to change node's path to CCK value I have a content type that has been turned into a Feature named "Earth News".  It includes an optional CCK field called "Source URL".  When that CCK field is not blank I want the site visitor to be able to click on the teaser and go straight to that URL.

I've added the following preprocess function to the .module file for this feature:

function earth_news_preprocess_node(&amp;$vars) {
  $path = drupal_lookup_path('alias','node/' . $vars['nid']);
  $url = $vars['node']-&gt;field_se_news_source['und'][0]['url'];

  path_save(array($path,$url));
}


The path_save is throwing a fatal error:

Only variables can be passed by reference


Am I on the right path?  What's that error all about?

Thanks.
I think what you should be doing is something along the lines of the following:

  $node=$vars['node']; // or however you get the node object

  $source = 'node/' . $node-&gt;nid;
  $alias = $node-&gt;field_se_news_source['und'][0]['url'];

  if (!empty($alias) {
    $paths=array('source' =&gt; $source, 'alias' =&gt; $alias);
    path_save($paths);
  }


but I would do in it hook_node_presave() instead.

Also be aware that I imagine this won't work if the url in your CCK field is not local to the host system.

More info:

http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_presave/7

http://api.drupal.org/api/drupal/includes!path.inc/function/path_save/7

And oh, the error is because you were passing path_save() the return value of the array() constructor and not an actual variable.