2

I am using the 'Advanced Forum' module with Drupal 7, in conjunction with the 'pathauto' module. I would like to include the parent forum, if not the container of the parent forum as well, in the URL of the forum topic, so it is like: forums/catergory/forum/topic-title. However, I can not seem to find compatible tokens/replacement patterns in order to do so, so I was hoping somebody here could provide a solution for me, please!?

So far all I have is: forums/topic-title!

0

I haven't figured out the replacement pattern for forum containers, but I did achieve this:

www.mysite.com/forums/forum-name/topic

using this pattern:

forums/[node:taxonomy_forums]/[node:title]

hopefully someone figures out the rest!

  • I actually forget I had this question going, and to be honest I don't need an answer anymore (at the minute) but thank you for your answer any way - its good to know for future reference. If I do need it and no solution to display the forum containers has been found by then I think I'd live with out! Thanks – Andy Apr 24 '12 at 16:28
7

After several hours, and help from the user spovlot in #drupal-support, we have a working answer for D7:

(edit: this has been tidied up some more!)

Pattern for all forum topic paths:

forum/[node:taxonomy-forums:parents:join-path]/[node:taxonomy-forums:name]/[node:title]

combined with

Pattern for forum and forum containers:

forum/[term:parents:join-path]/[term:name]

This gives a result of:

/forum/container/sub-forum/title-of-a-post

Note that:

/forum is the name of the forum (i.e. no a forum, but a description) Any number of containers and sub-forums will work. (forum/container/sub-a/sub-b/title-of-a-post)

Hope it helps!

  • 1
    Beautiful! Thanks :-) One note, I did have to enable the Entity tokens module (ships with Entity API) to get these tokens. spovlot++ too :-p – thirdender Apr 14 '14 at 21:33
  • Just like to add to this- make sure to delete any previous alias, then bulk update them all. I just wasted 2 hours of my life learning this the hard way! I couldn't figure out why the urls weren't updating! Good luck, and THANKS GUYS! – user800507 Apr 15 '15 at 17:19
2

Container and forum hierarchy is just a taxonomy (Forums by default). That's why you can't see any forum-related replacement tokens in the Pathauto configuration. All the vocabulary and term related tokens apply though.

Make sure the Forums vocabulary is the top vocabulary for the Forum topic node type at admin/content/taxonomy and configure Pathauto like follows:

Pattern for all Forum topic paths: [vocab-raw]/[termpath-raw]/[title-raw]

That will result in aliases like forums/container/forum/topic which I believe is exactly what you're after.

  • sorry for the slow reply, and thanks for your answer! Yes, aliases like that are what I want, however I believe that the solution you have provided me with only works for Drupal 6! Can you tell me how to do the same thing with Drupal 7 please? – Andy Aug 1 '11 at 10:34
  • I apologize, I failed to notice the Drupal version. I'm happily stuck with 6, which seems to be infinitely easier to solve your problem. It looks like Drupal 7 is lacking taxonomy tokens for node types. There is a patch around for that (bit.ly/pB23zX), but I'm afraid it would still not help to get the alias the way you want. Sorry again, all I can do at this point is to upvote your questions. – Jan Tomka Aug 1 '11 at 12:14
  • Sorry for the slow reply and thanks for your help. No problem about the Drupal version, I was only really testing D7 out, because there was a perfect module available for it which wasn't available in D6! For now, me and my friend are 'pausing' the project until further notice, so hopefully by the time we come back to it there will be a fix for this! Though if there is already a fix, I am still interested in hearing anyones solution! Thanks again for upvoting. – Andy Aug 3 '11 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.