I am working on a site that uses Subdomain/Pathauto to write user's blog entries (created using the Blog module) to subdomains. Ex: http://username.example.com

I'm also trying to set up the Feeds module so users can import blog entries from elsewhere. My Feed Importer is set to have feed items inherit their author from the feed node. That works. But the path alias for imported items is not being written correctly. My Pathauto for these items is set to
~[subdomain]/[yyyy]/[mm]/[dd]/[title-raw]

Instead of the expected
http://username.example.com/2011/04/13/my-node-title
I'm getting
http://.example.com/2011/04/13/my-node-title

I'm perplexed. Part of the [subdomain] token is there, but the author part is missing. The author, which is being inherited from the feed node, is somehow not available to Pathauto when the blog entry is first created. I cannot figure out a way around this.

I created an issue about this in the Feeds module queue over a month ago #1126778: Inherited author not printing in URL alias but it hasn't gotten any attention, maybe because it involves so many disparate modules. I would really, really appreciate any help. Really.

Comments

ayesh’s picture

I don't know if subdomain module does this. Domain Access module can do this.
You can assign subdomains to each user and by default, under default settings, author's posts go to user's domain.

Also, I don't think that [subdomain]/[yyyy]/[mm]/[dd]/[title-raw] pattern will return Ayesh.example.com/2011/05/18/inherit-feed rather than example.com/Ayesh/2011... pattern.

jenna.tollerson’s picture

If a user creates a blog entry by going to node/add/blog, I do get the correct path, so it is not a problem with the pattern.

It is only the blog entries created by importing via Feeds that don't end up with the correct path.

ayesh’s picture

Is the author correct?
Under node processor settings, you can set a global user and UID in mapping section.
Try mapping "Feed node: UID" to "UID".

jenna.tollerson’s picture

I already have "Feed node: UID" mapped to "UID" (I just double checked to be sure). The author actually gets assigned correctly; I can see the teasers with the Author's name, though I can't get to the nodes themselves because I'm getting these invalid paths.

jenna.tollerson’s picture

Who knows why the Pathauto pattern doesn't work correctly when Feeds is involved, but I was finally able to solve this with the Rules module. Here's my rule:

ON event After saving new content
IF
Content has type blog entry
DO
Create a URL alias (choose action "Create or delete an URL alias")

Create a URL alias looks like this:

Existing system path:
node/[node:nid]

Path alias:
~<?php $output = "[node:author-name-raw]/[node:yyyy]/[node:mm]/[node:dd]/".preg_replace("/[^a-zA-Z0-9\s]/", "", "[node:title-raw]"); $output = strtolower($output); echo str_replace( " ", "-", $output); ?>

Hope this helps someone.

Onomicon’s picture

I didn't do exactly what you mentioned but made a simple rule which fixed the problem.

Thanks!