I've been using pathauto for a while to alias nodes in the menu for three different sites. At some point roughly three weeks ago I must have updated the code to the lastest version 4.7 (v1.22). Now menu aliases are being created as "node/$nid," but I can edit them or bulk update to correct.

I did a search through the issue cue but could not find an exact match for my issue, but I did see serveral involving the taxonomy path. (possibly http://drupal.org/node/46682)

I'm running drupal 4.7.8 My settings are as follows:

Verbose = on
Update action = Create a new alias, replacing the old one
Default path = [catpath]/[nid] on one site and 'node/'[nid] on another
Pattern for all page paths = [menupath]

After creating a page and putting it in the menu, the node page displays 'node/118.' I looked in the url alias list and I don't see a any entries for the nodes I am trying to create. I can edit the node and I get a drupal message telling me it was correctly aliased, but my menu link seems like it might be cached at that point, because it still goes to 'node/118.' Bulk updating seems to fix the problem.

It almost looks like the menu is not getting to pathauto at the point where it is trying to create the path. Further evidence is that one site is set to use "[menu]/[nid]" and on node creation I get something like "example.com/118." This would seem to suggest that in the previous example, the alias is blank because there is no menu path, and in the second example only the node id is found.

I don't have time to test this assumption tonight, but I'll try and debug later in the week.

Comments

greggles’s picture

Sean - Thanks for your detailed report. This seems related to the issue 46682 that you mentioned, but perhaps not.

Can you please confirm a couple of things:

1) you said you were using 4.7.8 - which I don't think exists. Take a look in CHANGELOG.txt to see which version you are running.

2) you said that the Pattern for all page paths = [menupath] - is that it? [menupath]/[nid]

3) You mentioned configurations of two sites. Do both of them exhibit this problem? If not, is there anything different between them?

4) My understanding of [menupath] is that it is built from the breadcrumb for the page. Can you confirm where your breadcrumbs are coming from? That is - are they built by drupal core or some other module?

seanbfuller’s picture

Bah! I meant to say 4.7.2 (latest version). I even went to the front page of drupal to make sure I got the right one and still put in a .8 (the current 4.6 version).

I've currently got three sites in development running drupal 4.7.2 that use pathauto. They all seem to be exhibiting similar behavior. I remember updating their modules around the same time a few weeks ago.

Their specific pathauto settings for nodes are as follows:
site 1: page is set to [menupath] and I get 'node/118' after node creation
site 2: page is set to [menupath] and I get 'node/118' after node creation
site 3: page is set to [menu]/[nid] and I get '118' after node creation

The three sites have different modules, different themes, etc., so I could not really tell you if there was something similar to them. I set them all up, however.

I don't think I'm doing anything different with the breadcrumbs, and I can confirm that all breadcrumbs correctly reflect where they were assigned.

I'll try and dig a bit deeper tomorrow, when I have some more time.

seanbfuller’s picture

I'm pretty swamped today and won't have a chance to dig too deep, but I can say that editing a page node in the above example does not seem to create the proper alias as my description above may have suggested. Bulk updating from the pathauto page DOES build the proper alias, however. I'll test this more when I get a chance, but I just noticed this behavior and I wanted to clarify.

greggles’s picture

Sean - I'm having a hard time reproducing this error. I worked with menupath quite a bit as a result of #65654 but couldn't reproduce your problem.

Please let me know if you are still suffering from this problem.

Also, if you can doing a completely new installation and then see what steps you have to follow to create the problem that would be very helpful.

Thanks again!

seanbfuller’s picture

I just ran the following test on a vanilla install:

  1. Grab latest version 4.7 tagged version of pathauto
  2. Upload the pathauto folder to the server
  3. Log in as user 1
  4. Enable path and pathauto
  5. Go to admin > settings > pathauto and set "Pattern for all page paths" to "[menupath]/[nid]"
  6. Also check the "verbose" box
  7. Create a menu called "test" under the admin > menus screen
  8. Create a page called "test one" and give it the following menu settings: title = "test one" and parent = "test"
  9. Create four more pages called "test two" through "test five" so that there is some hierarchy.
  10. After saving page five I end up on ?q=865. The message says: "Created new alias 865 for node/865" (Note that this happened for all five pages that you have created at this point, but this is the best test case as there is a structure that should be getting built.)
  11. administer > url aliases shows an alias of 865 for node/865
  12. Editing the page does not update the alias and the URL path settings shows a value of "865". However, the message says: "Created new alias page_one/test_four/865 for node/865, replacing 865"
  13. If I remove the current alias in the node form, I get the same message, but now it appears that the alias of 865 is removed. The node will now only show up as "node/865"
  14. Future edits at this point say "Created new alias page_one/test_five/865 for node/865", but we are still only dealing with node/865

After running through this, I tried two other settings:

  • [menu]/[nid] was getting similar results where the [menu] part was getting ignored.
  • [menupath] results in no alias being generated at all, suggesting that path module gets a null value and ignores the whole process.

As mentioned above, bulk updating fixed all aliases.

Hope that helps.

seanbfuller’s picture

Ack! I forgot one step:

After the initial edits, after nothing was updating, I checked "Create a new alias, replacing the old one" under "Update action"

vatavale’s picture

i have the same problem after this path http://drupal.org/node/65654
i believe it's because the first container in my menu structure (i use category module) is hidden.

doudou’s picture

Version: 4.7.x-1.x-dev » 5.x-1.1
Component: Code » Miscellaneous

I have a similar problem. [menupath] will generate for taxonomy terms but not for any content nodes.

seanbfuller’s picture

I meant to come back to this issue, and I'm sorry that I didn't. I haven't had a chance to go back and test this on the site that was initially causing me problems, but I think my issues were caused by the weight of the modules. Again, I'm not 100% sure, but I think this is where the problem is located.

dingbats’s picture

Component: Miscellaneous » Code

I'm using Pathauto with the Outline module. Doing a var_dump of $_menu['path index'] in pathauto_menu_get_mid, shows that the value in the array is a negative menu ID. This could be the result of how Outline has created its volume structure in the menu array, I'm not sure yet.

But, it looks like my problem is caused by negative menu IDs, so Pathauto thinks that it is temporary and thus ignoring the menupath placeholder. Can anyone else verify if negative/temporary mids are the cause of their problems?

At this moment I'm unsure if the problem is because Pathauto and Outline are incompatible, or if it is a bug in Pathauto itself.

seanbfuller’s picture

Not sure about the negative menus, but I can say that I think I found my problem. I went back to do some maintenance work on one of the sites I was seeing this on and decided to take another crack at the problem.

I went into the system table and changed the weight of the pathauto module from 0 to 1, and all of the paths started generating correctly.

For the site in question, the pattern for page nodes is set to "[menu]/[nid]"

No idea why this was happening in this order, as the order of nodeapi modules when they're all set to 0 should be:

menu
path
pathauto

...which means the menu element should be in the node once it gets down to pathauto.

Anyway, hope that helps someone.

Leeteq’s picture

Should the version number for this issue be updated to 1.2?

greggles’s picture

Title: Pathauto ignoring menupath » Pathauto ignoring menupath - change pathauto weight to fix
Version: 5.x-1.1 » 5.x-1.2
Status: Active » Needs work

@dingbats - there's an issue in the outline module for it to deal with pathauto/token: http://drupal.org/node/105781 it's up to them to do it - not pathauto.
@seanbfuller - can you provide a patch which would do that? I'm marking this as CNW in anticipation of a patch that does what you mention.
@DanielTheviking - I believe this problem is still there in 5.x-1.2. We can move the version unless someone has tested it and found it to work fine already in 5.x-1.2 (though that would surprise me).

seanbfuller’s picture

I should be able to roll something up in a few days. I'm pretty snowed under right now, but I have a custom module that does something similar.

greggles’s picture

Marked http://drupal.org/node/113470 as a duplicate of this.

greggles’s picture

Status: Needs work » Fixed

I fixed this in the 5.x-2.x branch, so I guess that (shortly) as that becomes the standard people will get this bugfix by upgrading to that version.

Anonymous’s picture

Status: Fixed » Closed (fixed)