This is somehow related to separate aliasing for forums and forum containers.

Image_gallery module (part of image module) similar to forums use taxonomy in not common way. It introduces paths like image/tid/[tid] for terms. I created patch which is similar to forum one to handle this issue.

Comments

vito_swat’s picture

StatusFileSize
new5.47 KB

Forgot one slash to properly delete alias

greggles’s picture

Status: Needs review » Needs work

thanks very much for providing this, I think it will be a great feature.

One question - can you review this issue: http://drupal.org/node/188762

From a site of mine that uses image galleries it doesn't look like the image module provides any specific feed integration. So, we'll want to remove
+ $settings['supportsfeeds'] = '0/feed';

Also, if you can create your patch with "cvs diff -up" that makes it much easier to read.

vito_swat’s picture

Title: separate aliasing for image galleries » universal aliasing for taxonomies (was: separate aliasing for image galleries)
Version: 5.x-2.0-beta5 » 5.x-2.0
Status: Needs work » Needs review
StatusFileSize
new7.27 KB

During my studies on Drupal API I found very useful function taxonomy_term_path(). With it's help I was able to simplify solution for non-standard categories like forums and image galleries. All vocabularies are now handled by taxonomy_pathauto hook whenever they are standard or not.

To properly handle bulkupdate a hack was needed. I'm setting additional alias for taxonomy/term/[tid] to know that this term is already aliased. For example:
We have forum which source url is forum/14. We set pathauto to set this url to forums/this-is-test-forum. After my patch there will be 2 rows in url_alias table:
forum/14 -> forums/this-is-test-forum which is desired behavior
and
taxonomy/term/14 -> /forum/14 which is needed for pathauro to know that this term is aliased.

A nice side-effect is that even if we type in url www.example.com/taxonomy/term/14 we will get forum view instead of taxonomy view. If we have Global redirect module than Drupal redirects us straight on www.example.com/forums/this-is-test-forum.

I tested this patch with forum, image galleries and superb taxonomy redirect module and it's working fine.

Sorry for not creating my patch with -up parameter but my eclipse is unable to do it (or I don't know how to set up it properly).

eMPee584’s picture

Mhh I was just having the same issue (image_gallery's wired URLs) and was about to create some freak-patch for pathauto when I saw this.. do I need to apply the previous patch aswell.. or is this about to hit CVS anyways? thx & cheers..

greggles’s picture

@zuriel please review the patch in #3. test it out, look at the code and the approach. look for ways to improve it, etc.

@vito_swat - I haven't tested this yet, but do thank you for your investigation and novel approach to this idea. Hopefully it will solve this problem in a general way.

vito_swat’s picture

Status: Needs review » Needs work

There's no rule to have [tid] in uncommon taxonomy source path (but most have) so feed path for such a term will be broken.

I have to rethink this code once again and I'll provide new patch during weekend. I'd like to implement this with much cleaner code and without 'dummy_taxonomy' thing.

vito_swat’s picture

Status: Needs work » Needs review
StatusFileSize
new10.02 KB

This is new patch against current dev. I think it's much cleaner now. Again tested with modules: forums, image galleries and taxonomy redirect.

It also fixes a bug with creating alternate feed aliases even if there was 'Create a new alias. Delete the old alias.' option selected. To sovle this (and to reduce code) I introduced a new function _pathauto_existing_alias_data() which consist of part of the pathauto_create_alias().

greggles’s picture

It also fixes a bug with creating alternate feed aliases even if there was 'Create a new alias. Delete the old alias.' option selected. To sovle this (and to reduce code) I introduced a new function _pathauto_existing_alias_data() which consist of part of the pathauto_create_alias().

Can you clarify specifically what that bug is/was? I don't understand it from your brief description.

Also, please see RFC: should feed aliases get updated following normal "update action" settings? and discussion on groups.d.o about the topic of updating feed aliases when the underlying alias is updated.

vito_swat’s picture

Problem is exactly the same as described in RFC. I'll reroll patch tonight and I'll omit that part of the code until discussion ends.

vito_swat’s picture

Version: 5.x-2.0 » 5.x-2.x-dev
StatusFileSize
new9.65 KB

This took me little more than expected (I've so many work to do) but I finally rerolled the patch vs current dev and without changes in creating new feed aliases when 'Create a new alias. Delete the old alias.' option is selected.

Please review.

tj2653’s picture

subscribing

tj2653’s picture

Hi,

I tried this patch on a clean copy of Pathauto 5.x-2.x-dev. The image paths are working great now, but my forum paths aren't working anymore. I deleted all my aliases, and bulk generated everything. It looks like the paths are generated in the URL alias list:

forums/category/discussion taxonomy/term/1
forums/category/discussion/general taxonomy/term/2
forums/category/discussion/other taxonomy/term/3

But when I browse to the forums, here are the page locations:

Discussion http://mydomain.com/forum/1
-General http://mydomain.com/forum/2
-Other http://mydomain.com/forum/3

My setup in PathAuto is: [vocab-raw]/category/[catpath-raw], and this was working correctly before the patch. Any ideas?

EDIT: Actually, it's also not working for a few other sections, like blog and faq.

Thanks

herb’s picture

I just applied the pathauto_23.patch to the current dev version, and it seems to have fixed the problem I was having getting the image galleries to be correctly aliased.

I deleted all the category path aliases and then let the patched version run with the default settings for image galleries. Everything worked fine. I deleted them again, and changed the pattern to photo-albums/[catpath-raw].

It worked again, but gave a warning for each photo-album created.. user warning: Duplicate entry '2324' for key 1 query: INSERT INTO url_alias_extra (pid, dst, entity_type, entity_id, created_by) VALUES .........

However, the correct aliases were generated. Thanks

vito_swat’s picture

@tj2653
Could you check if you have following aliases for forum (I assume you have /forum/1..3 as you noted):

taxonomy/term/1 -> forum/1
forum/1 -> forums/category/discussion

taxonomy/term/2-> forum/2
forum/2 ->forums/category/discussion/general

etc.

@herb
This warnings are not related with the patch I provided. They show also on clean dev release. Check: http://drupal.org/node/196465#comment-643634

tj2653’s picture

Hi vito_swat. The only forum-related aliases are the ones I posted above:

forums/category/discussion -> taxonomy/term/1
forums/category/discussion/general -> taxonomy/term/2
forums/category/discussion/music -> taxonomy/term/3

They used to point to forum/1, forum/2, etc. before the patch (I deleted all aliases, and regenerated all aliases with the patch).

vito_swat’s picture

StatusFileSize
new5.36 KB

Well it seems that forum module don't implement hook_term_path, so it still needs special handling. I reverted forum specific functions I deleted in previous patch (but I don't like this solution) and made issue #197864 in Drupal forum module to make it properly in core.

My forum module was heavily modified so in my test environment it was working... Please test it carefully with forum and image galleries (add, edit, delete terms and nodes for both modules).

tj2653’s picture

Thanks - before I test this out, is this expected to also fix my similar problems with blog and faq taxonomy aliases?

vito_swat’s picture

This patch does not touch any blog aliases so I think your problem is not connected with this patch. If you have any other special taxonomies that don't work please provide detailed steps to reproduce the problem.

tj2653’s picture

I should clarify that they were blog and faq taxonomies...for instance they used to look like:

blog/category/fashion -> taxonomy/term/50
blog/category/food -> taxonomy/term/51
faq/category/general -> taxonomy/term/28
faq/category/posting -> taxonomy/term/29

I don't have what they turned out to be after my first patch because I've rolled back the DB, but the URLs were not the same (not blog/category/fashion, etc). I just tried the new patch, and either I patched incorrectly, or there's a problem. It says 50 aliases were created, but the list only shows 2, which are malformed:

blog/category/food -> taxonomy/term/
taxonomy/term/ -> taxonomy/term/51

vito_swat’s picture

I still don't know what modules do you use!

You mention FAQ. The only FAQ i found was the http://drupal.org/project/faq. If this is module you use than it doesn't have hook_term_path implemented so it will not work with this solution unless you post feature request to implement it.

The blog taxonomy also seems to be non-standard but I don't know what module is generating it. Can you provide result of the query SELECT vid, name, module FROM vocabulary on your database. It will help me to check if the patch will work for your modules.

my results are:
1 Forums forum
2 vocab taxonomy
3 Image Galleries image_gallery
4 FAQ taxonomy

And it works for all the cases except FAQ as I mention above.

tj2653’s picture

Yes, that's the FAQ module. Here are the results:

1 Forums forum
2 Category taxonomy (faq)
3 Category taxonomy (Organic Groups - og)
4 Category taxonomy (a CCK content type)
5 Image Galleries image_gallery
6 Category taxonomy (another CCK content type)
7 Category taxonomy (Blog)

All of the URL aliases except for Image Galleries were working with Pathauto until I implemented the patch. Is it possible to just patch for image_gallery and leave everything else the way it worked before?

vito_swat’s picture

StatusFileSize
new15.69 KB

I'll ask you again what modules do you use? I cannot reproduce your issues. Especially I cannot create any special vocabulary for blogs, and faqs are working the same way as before the patch (without the alias).

Please provide complete step-by-step instruction how can I reproduce your issues starting from point: install and enable module XXX version ZZZ. I have clean drupal 5.3 install with enabled blog, forum, pathauto(dev) faq(2.5) and image(dev) modules and after applying the patch I can't make pathauto to behave in the way you mention.

If you don’t help me I couldn’t make the patch better. Making it only for image galleries is bad practice because there are other modules which uses taxonomy the same way as image galleries (ie. taxonomy redirect).

EDIT:
I played more with my test enviroment and I guess your problem is with incorrectly patched module. For your convenience as an attachment I provide files that changed.

herb’s picture

I use tried using the current pathauto_24.zip to replace my previously 23 patched 5.x-2.x-dev.

I deleted all url aliases using vocabularies and terms and it seemed to delete all aliases, except the image gallery aliases.

I regenerated all vocab url aliases, and it worked fine. However, I think the last patch let me delete the image gallery aliases.

CORRECTION: - I just went back to patch 23 and it exhibited the same erroneous behavior - it doesn't seem to delete the image gallery aliases when you delete all url aliases using vocabularies and terms.

tj2653’s picture

Hi,

I realized that when I applied the second patch, I did it on 5.x-2.0 and not 5.x-2.x-dev. That explains the strange behavior with the malformed URL aliases in #19. Patch #16 seems to be working for me now, with all my modules. The modules I listed in #21 were the only ones that I have installed that are related. Thanks for your help.

greggles’s picture

StatusFileSize
new5.48 KB

vito_swat - thanks for your persistence with this issue.

I'm uploading a re-rolled version since HEAD has changed somewhat. I didn't test this with forum aliases (i don't use forum) or forum feeds. I'll do that shortly.

greggles’s picture

Status: Needs review » Patch (to be ported)

I made one slight code change to remove the space between the function name and the ( in _pathauto_existing_alias_data( but otherwise this worked as specified and fixed some relatively annoying bugs.

Otherwise this is applied to DRUPAL-5--2 and just needs to be ported (probably it will apply cleanly, but I haven't tested yet).

Thanks so much, vito_swat.

greggles’s picture

So...another question is how people can clean up their sites.

Should people delete aliases associated with image/tid/ and then edit/submit all of the terms for image galleries?

Also, after applying this I noticed that links from taxonomy/term/58 point to image/tid/58 and then image/tid/58 points to the actual alias.

Before the patch, aliases would get -0 added onto the end, now the (less important) taxonomy/term alias points to something that is not very friendly. I'm sure we'll get some people who don't see it as an improvement. The way this patch creates aliases makes the global redirect module pretty important.

Taiwan’s picture

I have a question regarding the best way to go about creating paths for taxonomies within my site.

The end result is I want to see a url liek this:

www.sitename.com/taxonomy/*identifier*/title where identifier is not a token, but taxonomy and title are.

I have already created 4 separate taxonomies, and some of them I don't want/need showing up as their own url. do you have any advice for this?

greggles’s picture

Status: Patch (to be ported) » Fixed

fixed in HEAD as well.

@Taiwan - your question is totally unrelated to this thread. Please open a new issue or ask your question in a different place instead of just adding it to some random issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

nancydru’s picture

Status: Closed (fixed) » Needs review

There was a piece missing: http://drupal.org/node/238213. Please apply the patch and test. Thanks.

greggles’s picture

StatusFileSize
new448 bytes

Here's the patch from that issue for completeness...

nancydru’s picture

StatusFileSize
new448 bytes

Missing a one line piece: patch attached.

greggles’s picture

Status: Needs review » Fixed

Applied to both HEAD and 5.x-2. Thanks, NancyDru.

nancydru’s picture

Thank you.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

mariagwyn’s picture

Status: Closed (fixed) » Active

Does anybody know if this was applied in the drupal 6.x version?

I ask b/c I have that version installed, and when I override my Image taxonomy, to get it to work, I have to do two steps:

1. Override using tax_redirect from tax/term/# to image/tid/!tid.
2. Manually create aliases from image/tid/# to image-galleries/friendly-name/friendly-name.

If I understand this thread (and I may not), this should do this automatically. Or no?

thanks,
maria

greggles’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
Status: Active » Postponed (maintainer needs more info)

@mariagwyn - please update to the latest 6.x-1.x-dev which had a small fix related to this and should fix your problems.

mariagwyn’s picture

I updated to 6.x-2.x-dev, an all seems well. Thanks!
M

mariagwyn’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)