Hi, I was using some PHP code to create node titles based on CCK fields. It was all working fine until I made changes to the code.
Now when my client publishes or unpublishes nodes, the title becomes something like [field_prefix-raw] Trachelospermum [field_species-raw]. The tokens are displayed if the values of their fields are empty.

When the node is edited and saved (without making changes) the node title is corrected. Through much experimentation is seems to only happen to nodes that were created with the old code, that are then published or unpublished with once the new code was instated. Once it is edited and saved the error never happens again.

Using Update Auto Nodetitles in Views Bulk Operations doesn't correct the issue, only editing and saving each node solves the problem. The site has hundreds of nodes that would need this to be done to so it's not really viable.

This is going to play real havoc soon, as all of the Pathauto paths are also being updated as [field_prefix-raw] Trachelospermum [field_species-raw] which is playing hell with Google searches!

Here is the code (I'm no PHP master BTW), it concatenates the title from various CCK fields if they have a value:

<?php
$prefix='[field_prefix-raw]';
$genus='[field_genus-raw]';
$species='[field_species-raw]';

if ($prefix) $prefix=$prefix.' ';
if ($species) $species=' '.$species;

$text=$prefix.$genus.$species;
return $text;
?>

Thanks for any assistance!

Comments

gaurav.kapoor’s picture

Status: Active » Closed (outdated)