I'm not sure if this is the right place to ask this, but if not, perhaps you can point me in the right direction.
I just updated my site from D5 to D6, and I found this module. Something I've wanted to do for a long time, but that has never worked, was to have the author name of a post link to the bio/profile node instead of the user page (this was supposedly possible even in 4.7 using a particular combination of settings, but I was never able to get that to work).
Is this possible with this module? Where do I do that? Overriding user/username didn't work (it didn't let me do that, and I didn't want to start deleting paths that might be important), so is there another general way to do this? It's okay if it's in the theme (some other function to create the link?), I have total control over that.
Comments
Comment #1
fagoIt'd work when theming the theme_username function. However I've no code ready for this, sry. If you do it please share the code.
Comment #2
dydecker CreditAttribution: dydecker commentedSubscribing.
I've found setting up user profiles quite confusing, partly due to this issue. Not being nodes, Drupal's user pages seem like a natural home for settings and management (private content), while the public page is better created as a node (using Content Profile). Is that the philosophy behind this module?
If so, usernames throughout the site should logically link to the "public" profile, not the private stuff. I'd be interested to hear if there is code to accomplish this, or whether this is generally the right approach that people are taking.
Comment #3
dydecker CreditAttribution: dydecker commentedHere is a solution for replacing “Authored by” information on nodes. If you want it to work for comments, first you’d have to install the Node Comments module, which turns Drupal comments into nodes, allowing you to use CCK on them.
1) disable all “Display post information” in themes/settings, which removes the “Authored by” fields and date” from your site.
2) Create a View of type: Node. The settings are:
Filter - Node: Type = Content Profile
Field – Node: Title
Argument - User: Uid
Check “Provide default argument”, and enter the following into PHP argument handling code:
3) Create a CCK field in the Content type you want the link to Content Profile in.
Type: nodereference
Widget: Select list
Global settings: check required
Number of values: 1
In “Advanced: Nodes that can be referenced”, select the view.
Now each node will link to the Content Profile rather than User Profile.
Comment #4
william_frane CreditAttribution: william_frane commentedI would find this functionality quite useful as well.
Comment #5
techypaul CreditAttribution: techypaul commentedsubscribing.
Is this something that is likely to be resolved?
clicking on avatars or usernames etc should take you to their bio page not user page, in fact, my account is the only place that should take you to the user page.
p.
Comment #6
haagendazs CreditAttribution: haagendazs commentedA temporary workaround could be creating a permanent redirect on the user page. On my site, all profiles are aliased using pathauto and are accessible through a URL as such: www.mysite.com/profile/username
To create the redirect, create a file called user-profile.tpl.php in your theme directory and add the following code to it:
This of course assumes the title of the content profile is the username, which can be achieved using node_autotitle.
Comment #7
Agogo CreditAttribution: Agogo commentedI've been searching for some less hack of a way to do this but all my findings were none succesfull mainly because I use panels. No templates in the world seemed like a good idea and I dont like the idea of redirects anywhere but have to have the functionality some way! Anyway, I thought of sharing my little snippet for those banging their head against the keyboard. It mich help someone with the thinking process at least. This is the code I used in template.php:
It simply checks whether youre trying to view your own user page or someone elses - if youre not trying to get to your own one it looks for the node-id of the content profile for the user you want to check out and then redirects you to that node. Works well with Pathauto as well since drupals arg() function checks the "real" arguments used - not the clean and dandy url youre seeing in the browser.
Ehm. Yeah. GL.
You might wanna check out these threads as well:
#276545: Have username link to profile rather than regular userpage by default
#236467: Integrate profile with user/edit
#356759: Tighter integration between profile nodes and user pages
#355760: Useful function.
Comment #8
rickh CreditAttribution: rickh commentedDaniel
For some strange reason the link then redirects to the online user instead of the user selected. For example the profile i want to access is "John" and it directs me to my profile. any help?
Comment #9
rickh CreditAttribution: rickh commentedFor anyone else that was uffering with this. By creating a user-profile.tpl.php file in your subtheme and putting the following code in, works like a charm. No idea how to code, but it works.
Hope this helps someone at least.
Comment #10
kehogo CreditAttribution: kehogo commented@rickh - thanks
I ended taking rickh's code and using it to override the "submitted by" string on content pages and have it link to the user content profile page using the title of that page (which was set to be the user's first and last name by using Automatic Nodetitle (http://drupal.org/project/auto_nodetitle)). I'm sure there's a slightly more elegant way of doing it, but it seems to work the way I need it to.
In node.tpl.php, replace
print $submitted;
with
Comment #11
kehogo CreditAttribution: kehogo commentedAfter some further work, I have a few clarifications.
First, getting the user id of the content creator is much easier:
Next, the first argument in the content_profile_load() function should be a string that is the exact name of the Content Type you've created. The Content Profile module creates a content type called 'Profile' so if you change this Content Type, you'll need to change this argument to match.
Comment #12
superdorx CreditAttribution: superdorx commented#9 works perfectly. Would be nice if the URL path for the link didn't still show the path to the Drupal user page. All links are being redirect to Content Profile user page. But this seems to me making good progress! Great job so far everyone.
Comment #13
TwoDUsng theme_username as suggested in #1 seems the easiest way to do this, here's the function I used in template.php. It's a mix between the original theme_username and acquia_marina's override which allows to toggle the "(not verified)" text. This way the links to "My account" still works and the public/private separation in #2 is achieved. One can also do the same with template_preprocess_user_picture() if you use the default user pictures.
Comment #14
stevep CreditAttribution: stevep commentedThanks Rickh
Worked okay, but lost My Account link to user. Now a new logged in user cannot access their account, only their profile.
Did anyone else have this problem?
Cheers
Steve
Comment #15
mojito_ CreditAttribution: mojito_ commentedHaving same problem. Any ideas?
Comment #16
mojito_ CreditAttribution: mojito_ commentedOK, I used #13 and amended template.php. Works perfectly. Thanks TwoD!
Comment #17
robby.smith CreditAttribution: robby.smith commentedCould someone please help add 'profile_first_name' as the themed username + #13 where it will link to the content profile node?
Comment #18
sean_a CreditAttribution: sean_a commentedThis works great! If a user doesn't have a profile though the link goes to /node. Is there a way to link to their user page if a content profile doesn't exist?
Comment #19
hedac CreditAttribution: hedac commentedThanks #13
I don't know why but removing the if of: if (!isset($profiles[$object->uid])) {
then works better for me.... I wanted to also replace the username with the Profile Title... so I need always the profile variable to update for some reason. so I just used $profile->title instead of $object->name if title is not empty. If it is empty in case user has no profile created then use username. It also links to user page if content profile does not exist.
Comment #20
honorfield CreditAttribution: honorfield commentedYou can automatically assign the username as title for the profile. Please see here: http://drupal.org/node/285367
Comment #21
sean_a CreditAttribution: sean_a commented#19 works great
small note: if you change the name of your content type for profiles, be sure to edit the line
to whatever is your content type name.
Comment #22
darrenmothersele CreditAttribution: darrenmothersele commentedI'd already implemented something like this before I found this thread. In my theme I created this function:
It works, generating a link to the profile node for valid users who have a public profile. I think I will add some of the functionality from #19 but the static cache code seems to be commented out. Is there a reason for this?
Comment #23
Michsk CreditAttribution: Michsk commentedIsn't this really a duplicate of http://drupal.org/node/661572