From 3c3c556c55555f431e388600f36cfa54959fc254 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 17 Oct 2003 16:00:44 +0000 Subject: - Bugfix: pass the node by reference in path_nodeapi so that $node->path is set for the node. Fixes bug #3680. Patch by Matt. - Bugfix: when creating a new node, don't try to insert a path if it wasn't set in the node form. This destroys any paths which the user may have created ahead of time for that node. Patch by Matt. --- modules/path/path.module | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/path/path.module') diff --git a/modules/path/path.module b/modules/path/path.module index 98ac778b8..0211ad910 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -137,7 +137,7 @@ function path_link($type, $node = NULL) { } } -function path_nodeapi($node, $op, $arg) { +function path_nodeapi(&$node, $op, $arg) { if (user_access("create url aliases") || user_access("administer url aliases")) { switch ($op) { @@ -165,6 +165,14 @@ function path_nodeapi($node, $op, $arg) { return form_textfield(t("Path alias"), "path", $node->path, 60, 250, t("Optionally specify an alternative URL by which this node can be accessed. For example, type 'about' when writing an about page. Use a relative path and don't add a trailing slash or the URL alias won't work.") . theme_error($arg["path"])); case "insert": + /* + ** Don't try to insert if path is NULL. We may have already set + ** the alias ahead of time. + */ + if ($node->path) { + path_set_alias("node/view/$node->nid", $node->path); + } + break; case "update": path_set_alias("node/view/$node->nid", $node->path); break; -- cgit v1.2.3