views:

247

answers:

3

In Drupal I wish to create a content type as a bio for a user. When you click on a a user name on the site it takes you to there bio. An example I have found online is below.

This article has the authors name Jeff Robbins. Jeff Robbins name links to his profile. How would you go about doing something similar? It does not seem be using the default profile module.

I would ideally only like this to happen for users in a certain group. For other users I wish just for there name to display but no link. Any pointers about how I would do this?

+1  A: 

The node creator is stored in the node table (column UID), you could write something in a nodeapi hook to take that insert it as a field which can then be themed however you want. You could even in this hook put some logic to make the name a link or not depending on the roll.

You may want to look at the profile module, as this will allow you to set up a bio much more easily.

Jeremy French
The problem with profile module is that I only want a certain group of users to have a profile. Thanks for the help. Will have a look...
Jack
You can do that through standard permissions I think. Give the users you want a role, and only allow that roll access to profile.
Jeremy French
A: 

You can like Jeremy suggests do something like using hook_nodeapi(), but that seems like a bit overkill. I would instead use the template_preprocess_node() function. You could put this into a module or a theme. With it you can change the variable for $submitted, which holds the info for the author, date published etc. You can format it like you want, and keep the date and all that, and just instead make a different link on the user.

You could make it point anywhere really, so that the user is directed to a custom page that holds info on that user. It could a node on itself that you can setup with CCK ect, or you can use one of the profile modules that let your users customize their profiles, whatever works best for you.

googletorp
Just to confirm if you only wanted this to happen in one theme you would do it in your theme. If you wanted it to happen on all themes on the site you would create a custom module?
Jack
Generally I would only have one active theme on a deployed site, so that is where I would put it. If you want more than one active theme on your site, it's better to do this in a module.
googletorp
+2  A: 

You've already got the core/programming route explained, so I thought I'd chime in with a few signposts on the install-a-module route. As always, with modules there is a bloated but supported solution and guidance on DIY.

Content Profile

Content Profile is a module specifically targeted at supported a User Biography as a node.

Here is an article describing how to add author biographies to nodes using Content Profile.

Author Pane

This module pulls information from the profile with an eye toward creating the sort of author information you would find to the left of a messageboard post.

Permissions

There are a couple modules that add finer control to the Profile permissions mechanism. There may be more, but these jumped out while I was looking for Content Profile.

Grayside