summaryrefslogtreecommitdiff
path: root/modules/path/path.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-10-17 16:00:44 +0000
committerDries Buytaert <dries@buytaert.net>2003-10-17 16:00:44 +0000
commit3c3c556c55555f431e388600f36cfa54959fc254 (patch)
treee3705888ea85bda78e17eac9447befe936acebb1 /modules/path/path.module
parent880842885bd3e970bb752248ba72fb7b9957bc77 (diff)
downloadbrdo-3c3c556c55555f431e388600f36cfa54959fc254.tar.gz
brdo-3c3c556c55555f431e388600f36cfa54959fc254.tar.bz2
- 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.
Diffstat (limited to 'modules/path/path.module')
-rw-r--r--modules/path/path.module10
1 files changed, 9 insertions, 1 deletions
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;