By jack_of_spades on
I'm having a problem with a home-built node type. path_set_alias doesn't seem to want to work inside my implementation of hook_update. If anyone can shed some light on this, I'd appreciate it; I have about a week's PHP experience and identical code seems to be working properly in hook_insert.
function item_update($node) {
// Set up an alias in the form 'item/name';
$alias = str_replace(" ", "_", $node->title);
$alias = str_replace(array("!", "~", "`", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "=", "{", "}", "[", "]", '"', "'", "<", ",", ">", ".", "?", "/", "|", "\\"), '', $alias);
$alias = strtolower($alias);
$alias = htmlspecialchars($alias);
path_set_alias("node/" . $node->nid, 'item/' . $alias);
// Properly functioning database update code omitted.
}