As a module developer, I would expect that pathauto would set this value in it's implementation. But it does not. Hilarity does not ensure, as $node->path is always blank on node insert.

CommentFileSizeAuthor
#1 816434-pathauto-reference.patch560 bytesagentrickard
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

Version: 6.x-2.x-dev » 6.x-1.3
Status: Active » Needs review
FileSize
560 bytes

And a patch against 1.3.

Dave Reid’s picture

Version: 6.x-1.3 » 6.x-1.x-dev

Setting to 6.x-1.x so it can be run against tests.

greggles’s picture

Makes sense to me.

Dave Reid’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Dave Reid’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: Unassigned » Dave Reid
Status: Closed (fixed) » Active

Seems some abstractions removed this from 6.x-2.x and 7.x-1.x.

Dave Reid’s picture

Re-applied to 6.x-2.x.

danielb’s picture

subscribed, I see no $node->path in Drupal 7. Need it for the node_export module to work.

danielb’s picture

Looks like I found an explanation for why this is the case
http://drupal.org/node/332333#comment-2163634

ExTexan’s picture

Ok, so... with no replies after the "found an explanation" of 22 Sep 2011, I'm not sure the status of this. Should I apply patches in the thread linked to in #9, or has that been added to core?

And, regardless of that, I'm still not getting the aliased path in my hook_node_insert function (D7 of course), so if it *has* been fixed in core, I guess *this* module still needs a fix, or I need to know how to do this.

I'm sending email notifications when certain nodes are created or (sometimes) updated. The emails include a link to the node and I naturally want that to be the aliased path instead of "node/{nid}". I'm doing this in hook_node_insert() and hook_node_update(). "update" is not a problem as the alias field is populated, but in hook_node_insert it is NULL.

I've tried setting the weight of my module to a higher value than pathauto, that didn't work. I tried reloading the node (via node_load) just before sending notifications. The only thing that did is make the "path" field disappear entirely from the node object.

Please advise.

  • Dave Reid committed 300323a on 8.x-1.x
    #816434 follow-up by Dave Reid: Fixed $node->path not updated when alias...
  • Dave Reid committed e30e3ab on 8.x-1.x
    #816434 by agentrickard | Dave Reid: Fixed $node->path not updated when...

  • Dave Reid committed 300323a on 8.x-1.x
    #816434 follow-up by Dave Reid: Fixed $node->path not updated when alias...
  • Dave Reid committed e30e3ab on 8.x-1.x
    #816434 by agentrickard | Dave Reid: Fixed $node->path not updated when...