[termalias] token not working properly for non taxonomy vocabularies

File: pathauto.module
Line 143 - 144 should be:

$term = taxonomy_get_term($category->tid);
$values[$label .'alias'] = drupal_get_path_alias(taxonomy_term_path($term));

instead of:

$values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);

Comments

seaji’s picture

Is anybody noticed me???

ahkiam’s picture

By "not working properly" what do you mean? What's happening -- is it similar to http://drupal.org/node/354100?

seaji’s picture

I think that enclosed code explane itself fine.
But if you want particular use case I do it.

I write my module "journal" that manages own vocabulary and output of articles listings.
Example:
System path: journal/term/26 (registered menu callback)
Alias : journal/events
Title of this term in Russian: события
taxonomy path "taxonomy/term/26" - have no alias and is not used in site.

Articles marked "события" (taxonomy term 26) should be displayed on the page "journal/events" and each of them should have alias "journal/events/3456" where 3456 - node ID.

My pattern for pathauto is : [termalias]/[nid]

Before this patch I have auto alias: "3456" instead of "journal/events/3456".
This patch fix this issue.

seaji’s picture

The same issue you may face with "Image" module and "Taxonomy Redirect" module under certain conditions.

seaji’s picture

Any response?

greggles’s picture

Any response?

Sure. I'm not affected by this bug and don't immediately see a way to fix it. If you want it fixed, you'll likely need to dig in yourself and provide a patch and get it reviewed.

You may also want to try 5.x-2.x-dev. There haven't been many changes, but I believe there was a change related to this.

Also, the more you bump an issue the less likely I am to help with it (or help you in the future in general).

seaji’s picture

I am not much skilled in making patches. But I post fixing code in the first post.
File: pathauto.module
Line 143 - 144 should be:

$term = taxonomy_get_term($category->tid);
$values[$label .'alias'] = drupal_get_path_alias(taxonomy_term_path($term));

instead of:

$values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);

And I NEED NO HELP. I fixed it for my self. But I want to ease life of comunity members.

If you do not want to maintain your project then only God can help you.

greggles’s picture

Status: Active » Closed (duplicate)

If you do not want to maintain your project then only God can help you.

Seriously?

This was already fixed in HEAD!

seaji’s picture

Duplicated? Hm...
Point me duplicated post.

seaji’s picture

Status: Closed (duplicate) » Active

Not duplicated.

seaji’s picture

StatusFileSize
new11.06 KB

It is not fixed in HEAD!
see img.

neochief’s picture

Status: Active » Needs review
neochief’s picture

StatusFileSize
new964 bytes
new848 bytes

As I can see, this bug currently present in both branches.

neochief’s picture

Version: 5.x-2.3 » 7.x-1.x-dev
StatusFileSize
new952 bytes

Here's also for HEAD, I don't know which is actually needed.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Confirm this bug, taxonomy term should be passed through hook_term_path because some vocabularies use own path for example core forum.

Patch from #13 against 6-1 works fine for me, suppose other branches should be fixed the same way

greggles’s picture

Any chance I can convince someone to write simpletests for this? We've already got tests started - they just need a little more love to cover this scenario. Docs on how to write/debug simpletests are in http://drupal.org/node/394976

andypost’s picture

Suppose test should be like:
1) enable core forum
2) setup path alias for taxonomy/term/
3) setup path alias for forum/
4) create forum
5) assert check path alias for taxonomy/term/{forumID} which should be different from forum/{forumID}
because core forum overrides this through hook_term_path

http://api.drupal.org/api/function/forum_term_path (maybe d7 have a some test for this case)

greggles’s picture

Title: [termalias] token not working properly for non taxonomy vocabulareis » [termalias] doesn't work for vocabularies that define their own path
Status: Reviewed & tested by the community » Needs work

Fixed for 6.x-1.x and 6.x-2.x (the old head) can someone update this for 7.x?

Thanks neochief and andypost!

Edited to add links to http://drupal.org/cvs?commit=326976 and http://drupal.org/cvs?commit=326974

dave reid’s picture

Status: Needs work » Fixed

In D7 taxonomy_term_path is gone, so this is fixed for all now.

Status: Fixed » Closed (fixed)

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