Adding Profile Information to a Blog or any other Node

Events happening in the community are now at Drupal community events on www.drupal.org.
gonz's picture

Hi Folks - I am looking for some guidance - hopefully one of you can help.

Basically - I am trying to create a Blog Author information Box to every Blog Entry Node - I want to include a custom Profile Field "profile_bio" that is filled out by the user at Registration time. Does anybody know how to do something like this?

I am hoping to have it similar to this WordPress theme: http://snowboardproject.com/featured/looking-good-feeling-good-von-zipper/

I created the Profile Field called: "profile_bio" - /admin/user/profile

Now I want to add that to my node-blog.tpl.php

I tried:

<div id="writer" class="clearfloat"><?php print $picture ?>
<p><?php print t('Posted ') . format_date($node->created, 'custom', "F jS, Y") . t(' by ') . theme('username', $node); ?> Bio: <?php print check_plain($account->profile_bio) ?></p>
</div>

but no love...

Any thoughts?

Thanks in advance,

Brian.

Comments

need to load the user object first

levelos's picture

E.g.,

global $user;
echo $user->profile_bio;

Lev Tsypin


ThinkShout, Inc.
thinkshout.com | twitter.com/levelos

Hello, is this really

svihel-gdo's picture

Hello, is this really working? I did go through similar steps as Pairodimes and then add this code into node-blog.tpl.php and it didn't work for me :(
I'm using Drupal 6

Using "global $user;" would

jhedstrom's picture

Using "global $user;" would show the current user's bio rather than the node author's bio.

Hm good point, so it

svihel-gdo's picture

Hm good point, so it wouldn't worked anyway. I'm still curious why it didn't show anything to me. I had only one user on my testing site (uid 1), so there shouldn't have been error here.

Make sure the user viewing

nonsie's picture

Make sure the user viewing the page has access to user profiles.

For what its worth, this is

mikey_p's picture

For what its worth, this is also possible with the new Views attach module.

To do this, simply create a view based on the user table that references the field or fields you want pulled into the node view. Then add an argument to that view, for 'User: Uid', and under action to take if argument is not present, select the 'Provide default argument' option, and in the options below that select 'User ID from URL' and make sure 'Also look for a node and use the node author' is checked as well. Then add a 'Node content' display and under the display settings select the node type you want to apply this view to. To apply it to more than one node type, just add another 'Node content' display.

Then, to see this information on your node, go to admin/content/types and click on the 'Manage fields' link next to the content type you which applied your display. From here you can drag and drop the view into the position you want it on the node just like any other CCK field.

Views Attach works great.

Oddible-1's picture

This method worked great for me - very simple. I used a Block rather than Node Content.

Same for me ! Thx a lot ! -P-

pacome's picture

Same for me !
Thx a lot !

-P-

Thank you!

JennySmith's picture

I was able to use this method along with Merlin's comment here:

http://drupal.org/node/246742:

<?php
$view
= views_get_view('viewname');
print
$view->execute_display('default', $args);
?>

to get my author information view to show. I love Views. And thanks for the simple explanation, mikey_p.

Display in a block, no code needed

bonobo's picture

You could also use the views module to generate a block with the author info --

Set the argument to take the nid of the current node.

Then, use the author field in the fields section. If needed, set up a relationship with the profile node; otherwise core profile fields can just be added via the fields UI.

Displaying this in a block eliminates the need for Yet Another Module, and reduces the amount of site-specific theme code you would need to write.

Cheers,

Bill

what if i have multiple authors?

anniewang's picture

Hi, this all works for me for nodes with one author. However, I am using the Author Taxonomy module that allows multiple authors per node. How do I get the block to show all of them? Right now since the argument is set to "select 'User ID from URL' and make sure 'Also look for a node and use the node author'" it is only showing the first author (by alphabetical order).

PLEASE HELP!

there is a small glitch...in

halisemre's picture

there is a small glitch...in Vies/Node Content/Node Content Settings if I choose argument "none" teaser view of fileds does not work but if I choose other options it works but other options doesn't do the job I would appreciate some feedback on this.

Portland (Oregon)

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: