By unkommon on
I have a question concerning the "Submitted by". On http://www.wildleaf.net/ I want to have it be more like a Newspaper style. It is a submission/contribution site for authors to tout their work. However, I have changed the "Submitted by" text to say "Authored by" and I need it to say their REAL name after it instead of their username. I have created a new profile entry for it and it is called profile_name. I just can't figure out where I could make the change I am suggesting. Someone help!
Comments
You would have to change the theme's code
Which theme template are you using? Xtemplate or phptemplate? You will need to change the code in the template files to make this change. This is not a feature built into Drupal.
Your other option is to make sure people register with their birth name. But this only works if you have very tight control over the registration process.
Hmmm...
Well, all that I see where their name appears is:
<div class="submitted">{submitted}</div>So, I am using Xtemplate. I am not sure where I would edit the actual appearance of what {submitted} is. I have looked in just about every file for the word "submitted" and have come up with nothing. The way I get their full name is through an added profile variable. I want to seperate their login name from their display name.
I'd check out
I'd check out http://drupal.org/node/14466 which goes over lots of user profile overrides if you are using phptemplate. I'm still working on getting that info displayed through node.tpl.php though as well. For example
doesn't seem to work. It also doesn't respect the display info on certain nodes settings in the theme configuration.
Not using phptemplate
I am not currently using phptemplate. What are some advantages to using it? I rather like XTemplate, and dont see any reason to change. Figure there has to be a way to do this using XTemplate....
That does not work because
That does not work because user_load does not get executed in every page load.
--
Drupal services
My Drupal services
--
Drupal services
My Drupal services
Would this help
You could do the following
Modify the template engine (themes/engines/xtemplate/xtemplate.engine) as follows
In the function xtemplate_node modify the entries for 'submitted' and 'author' changing the call from format_name to xtemplate_format_name. (You can also change 'Submitted by' to 'Authored by' here.
Add the function xtemplate_format_name - it might look
Where I have profile_lastname you will want to use the profile field(s) you wish to display. If the field is empty, it defaults to the current behaviour.
Steve
PERFECT!
Great, The idiot that I am, I didnt check inside the "engines" folder. Thanks for this fix! I altered it a bit to retain the link to user profile... Actually made the link into a user post tracking. Great! This is why Drupal is so great, so many nice, smart people helping everyone out with their own contributions.
used this but it stopped working.
i was using this method on one host (using drupal 4.6,phptemplate) and it worked flawlessly.
this week i moved my site to a new host (using drupal4.6.3) and broke this feature. It works great while the user is logged in however reverts to "format_name($node)" if the user is not logged in.
does anyone have an suggestions for what could be wrong? i'm racking my brains out trying to figure this one out.
-jc
That makes sense.
When a someone is not logged in they will not have a profile and there for if ( $account->profile_fullname ) will always fail and the else branch will call format_name($node).
Update...
Apparently this same code which produced flawlessly on my old host now doesn't perform its intended function at all.
When the visitor is not logged in it displays the username of the node creator. However, when the visitor is logged in, it displays the visitor's full name instead of the creator's full name.
If it helps, I'm calling the function "custom_format_name(node$)" from "phptemplate_node()"
and then accessing it in the template using $name.
Any comments?
solved...
ha, developing in the wee hours of the morning may not be such a good idea after all... i apparently didn't read the thread close enough...
final working code:
Help with PHPTemplate + Locales
Hi,
I'm using PHPTemplate + (spanish) Locales, bluemarine port for PHPTemplate.
I need to display on each node, teaser, forum topic and comment and flexinode:
Submitted by {profile_name} + {profile_lastname}
I found there is this locale string:
Submitted by %a on %b.
themes/engines/xtemplate/xtemplate.engine:44;84
and that although I'm using PHPtemplate, the string does modify output.
Can someone please tell me how should I proceed to achieve the desired result?
Any help will be appreciated.
If using PHPtemplate look at the node.tpl.php file
For PHPtemplate the file node.tpl.php controls the formatting of node content. In it will be a line like
Which you will want to change to something like
Thanks for the topic and
Thanks for the topic and code!
Lsabug