I'm using Pathauto to set my user profile pages to simply www.mysite.com/user_name
It works wonderfully.
However, I've created my first CCK/Views/Contemplate node, and now the $name function isn't working right.
I've explained everything here, but was directed to this forum.
The short version is that when creating a contemplate template using the $name call, it returns the user's name (right), but a link to $name ALSO simply returns the user's name. So if my user has a one-word name, great--it's going to the right place. But if they have a name with spaces, the spaces appear in the URL, which is different than the [name] call in Pathauto.
What am I doing wrong?
Thanks!
Comments
Comment #1
sinker commentedWow, I just re-read my post and realized that it doesn't make much sense unless you click on the link to the original question. The person who helped me and directed me here said it best:
"Haven't used the pathauto mod myself, but you should be able to find out how to code your links with whatever variable pathauto spits out for $name (the pathauto=ized name variable, as it were)"
So yeah, that's what I'm looking for.
Comment #2
gregglesI think what you want is "pathauto_cleanstring()".
I would suggest that you change your pattern to be users/[name] though due to the dangerous patterns problem.
I closed this because I think I've answered your question, but if that doesn't work please move this back to active status and let me know how/why it's not working.
Comment #3
sinker commentedCan you give me that in more context? How/when do I call this?
Thanks!
Comment #4
gregglesI responded in that forum thread and wanted to document it here as well:
Let me know if you need more help.
Comment #5
sinker commentedPlugging that in doesn't seem to be working--it leaves the name blank, so the text reads "listened to by on" with no name, link to profile, or anything.
Comment #6
gregglesWell, that's the function to use. I can't really debug your use of it from here so I'm afraid you'll just have to debug yourself.
One other tip - if you are linking to something like user/UID then you can just use the l() function like l('user profile','user/'. $uid) and it will automatically convert it to the internal alias for that path. Does that help?
http://api.drupal.org/api/5/function/l
Comment #7
gregglesClosing given no response.