Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How do I create a menu link to a user's profile node please?
Comment | File | Size | Author |
---|---|---|---|
#7 | 331821.patch | 1.8 KB | George2 |
Comments
Comment #1
blackdog CreditAttribution: blackdog commentedA content profile node gets a node id just like any other node, so you can link to that.
Comment #2
fehin CreditAttribution: fehin commentedI don't think that's what the person was asking.
I'm also looking for a way to do this.
I want users to be able to click on a member's name in my forum and it takes them to that member's profile. I used '/user' and it takes the anyone who clicks on the name to their own "my account" page. What link can I use for this? Thanks.
Comment #3
VM CreditAttribution: VM commentedcorrect /user isn't enough as that dynamically grabs the UID of the user who is doing the clicking of the link.
You may need some php for this in your theme.
Comment #4
arilikeairy CreditAttribution: arilikeairy commentedAny suggestions on the PHP?
This seems like a pretty big issue to me...isn't the whole point of user profiles to let other users view them? I've messed around with this for a few hours now and I can't figure anything out working with an unhacked module.
Comment #5
jeellis2 CreditAttribution: jeellis2 commentedI'm also looking for a way to do this, any hints regarding the "php for this in my theme"
It is a fairly basic need to be able to view other profiles on the site, correct?
Comment #6
andreiashu CreditAttribution: andreiashu commentedI think solving #236467: Integrate profile with user/edit can also solve this issue. Takeover profile functionality would replace the users page with the its Content Profile node so if you profile a link like
node/[uid]
(where [uid] is the user's id) we could accomplish what you need here.Comment #7
George2 CreditAttribution: George2 commentedvery dirty hack patched on beta3 to add an edit-profile link. it adds a menu item at the path edit-profile which just redirects to the real profile editing url
i've not been following all the content_profile issues, but is the idea to allow more than one profile content type per user? if so, then avoid this patch :)
Comment #8
fehin CreditAttribution: fehin commentedI placed this line
print $name;
in my node-forum.tpl.php and it gives me a link to the user's profile. You can place it in content types like comment.
Comment #9
superdorx CreditAttribution: superdorx commentedI'm waiting for the release of this module in 6. I believe will be the easiest method to add menu items.
http://drupal.org/project/menu_token
Comment #10
malc_b CreditAttribution: malc_b commentedIf you add token and automatic aliases then you can give profile nodes an automatic alias of /profile/[author-uid]. The do something similar for the menu.
Comment #11
superdorx CreditAttribution: superdorx commentedThank you for that. Can you please explain this in more detail? Has anyone successfully done this?
Comment #12
superdorx CreditAttribution: superdorx commentedNew solution as of today! Check out new added feature to "me aliases" module here http://drupal.org/node/450460. Use global tokens as provided by the http://drupal.org/project/token module, including [user-name].
Comment #13
malc_b CreditAttribution: malc_b commentedInstall token http://drupal.org/project/token and automated aliases http://drupal.org/project/pathauto . Then go to /admin/build/path/pathauto and under the setting for the user profile node content type insert
/user/view/[author-uid]
So /user/view/3 will show you user 3 content profile page and so on. The author of a content profile is always the user that profile refers to.
That works. I haven't tried a menu yet but I'd guess /user/view/[uid] may work and if not a bit of php would sort it.
Comment #14
13rac1 CreditAttribution: 13rac1 commentedme aliases cannot link to URL aliases, such as what would be created with profile/[author-id] by pathauto. It can only link to the edit view of a content profile because that is a real(specified by module) path.
Is there any other way to do this? It is fine if I have to use me aliases. Can we get a redirect at user/[uid]/profile/profile_name/view to the actual profile? For now, I think the quick option for me (since I am not using the profile module), is to write a simple module to redirect /profile to /profile/[uid].
Later, if not done, I will write a patch to do this. Right now I am looking at deadline, so that is not an option.
Comment #15
jonhattanI do this in my theme to add a link to edit the profile node in
Comment #16
Patroclas CreditAttribution: Patroclas commentedIt's nearly two years on from my first post on this and there is no useful solution.
It's easy to set up a link for a user to edit their own CP node. The path is just "node/add/[content-type]" where [content-type] is the type atached to the content profile. If the node already exists, it's shown in edit mode.
There is still a real need to be able to view a user's CP node without linking to their profile. Although this is a great module, and my site would not be possible without it, I still find the various tabs in the Profile page to be a nuisance and have never found a satisfactory way of organising them. It would also be great to be able to send a link to the user's CP node in a message from their contact form (instead of lnking to user/[uid]) and to be able to set a menu item for users to view their own node without going to their profile or the edit screen.
Comment #17
cbearhoney CreditAttribution: cbearhoney commentedjonhattan: Where do you put this theme function - in your template.php?
Comment #18
z3cka CreditAttribution: z3cka commentedI was in a situation where I wanted to keep the links to the user pages intact and be able to link to a users profile from a node that was created by that user. I was able to do this by preprocessing a variable like this:
template.php
This assumes you are using a CCK field for First name (field_name_first), but this text can be substituted with static link text or whatever. Also, the Content Profile content type is profile.
Then, in node.tpl.php (or node-NODETYPE.tpl.php) print this new variable like this:
And style.
Comment #19
rayvan CreditAttribution: rayvan commentedI just needed to add this to a block, so this is the PHP I used:
Sort of inefficient but a suitable short-term measure until the larger problem is addressed.