开发者

Drupal linking a Username to a Node

开发者 https://www.devze.com 2022-12-08 04:23 出处:网络
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.

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?


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.

  • Profile Role
  • Profile Permission


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消