Display author info in contents

julioc - March 9, 2008 - 16:55

Hi all, how can make publish the author’s email and name (this is a custom field created) in a page/story content, so any visitor of my site can view those details.
I have searched for it but unsuccessfully ;)
Thanks

nodeauthor info may do it for you...

zilla - March 9, 2008 - 18:56

http://drupal.org/project/nodeauthor

think this is what you're looking for...

Thanks for your answer, but

julioc - March 10, 2008 - 01:03

Thanks for your answer, but this module is not usefull for me (I have been see it befere posting in this forum)
This module display any info entered by the author, and I want to restrict for only display email and name

Julio Cesar Rodriguez

cck will do this...

zilla - March 10, 2008 - 01:09

okay, then for the content type 'story' you can use CCK to add two field types: one for name and another for email (you may need to email field cck plugin to make it a hyperlink) - then you can control where they display within a post (top or bottom) and voila, they will be in all story type postings - and i believe that there's a way to make them 'required' but i'm not sure how (you can probably just also put up a note for the field that says "you must include your email/name" etc)

also, if you use CCK to do this, then you may or may not want to leave the user link in the content type - in that case, go to content types, and you should be able to set 'username' to not display in the posting (because you want 'full name') - or if you want both, then just leave it alone...

interesting ...but

julioc - March 10, 2008 - 05:30

This option almost fit with my needs and maybe I will use it if I not find something better, but at least I had learned something new with your idea, thanks again.

The problem is that the cck solution requests to enter the email and name on every new post but this info are in the database yet! So users don’t should re enter data but must be taken from the database, like the picture or the username. I can see a way to minimize this, it consist in adding a default value to the field, in the php code area (just executing a line that return this data from the currently logged in user), but I am not happy with it neither, since the user must not be able to change it when create a content, this process must be transparent to the authors (if they want to appear with other data must go to edit theirs profile).

I think the way to solve this is not changing the input content rather than the output of the content for presentation, so a sort of modify a variable from the template either adding new variables to the node or changing a variable value (e.g. adding code html to the picture variable that also display email and name), but this solution needs some skills of php, drupal and maybe sql which I haven’t, so would be great if someone post here a snippet for it.

I was thinking to use the views modules but I have not found how to solve with it, maybe it can’t.
Zilla, regarding the “request” condition, the cck give this option. With the username you are right I want to not display it but I don’t know where I can configure it (neither in content type or user settings) could you explain in a detailed way please …I’m a drupal newbie ;)
Thanks

Julio Cesar Rodriguez

i forget!

zilla - March 10, 2008 - 15:10

i think that under user settings OR post settings (probably post settings) there's a set of options regarding what to show with each content type (e.g. do not show author and date information on the following types of content:)...

I've been looking everywhere

AndyF - April 2, 2008 - 09:33

I've been looking everywhere for that option (I've used it before, just can't remember where). Yeah, you would think of finding it under Post settings but no such luck! Finally I found this link:
http://urlgreyhot.com/personal/weblog/drupal_tip_4_removing_author_date_...
It's a bleeding theme setting! I'll forget that again in a couple of months...

A.

Hmm

cmckay - April 2, 2008 - 14:45

I dont know if this will be much help, but on my site for example, the news page displays the authors name and date while the downloads or the Guides page doesn't display the authors name. I did this by creating a node.tpl file for each content type and theming it accordingly.
This page will show you some available variables http://drupal.org/node/11816.

Another alternative will be to use the Private message module which gives you the ability to add a write to author link to a specific node type.

www.myappleguide.com

Current solution

julioc - April 19, 2008 - 01:11

Thanks all, here is the solution that we had done, I think it would be better but this work ;)

For the name:
Creating the field profile named profile_real_name and used the idea described here http://drupal.org/node/122303#comment-280052, just changing all ocurrences of "profile_last_name" by "profile_real_name"

For the email:
I putting this code in the node.tpl.php file to display a mailto link:

<?php
  $result
= db_query_range('SELECT mail FROM {users} WHERE uid = ' . $uid, 0, 1);
 
$account = db_fetch_object($result);
?>

<div class="email"><a href="mailto:<?php print $account->mail ?>"><?php print $account->mail ?></a></div>

hopefully this can help others.

 
 

Drupal is a registered trademark of Dries Buytaert.