I'm having a hard time figuring out where I am supposed to change things like "submitted by" and how the date on that line is displayed. Currently it displays like:

Submitted by admin on Sat, 06/24/2006 - 3:49pm.Category

I'm hoping to change it to read:

by admin | 06/24/2006 | in Category

Where do I change this?

Comments

Cerel’s picture

One way to customize the text is to use the "locale" module.
That module lets you translate your web site, but it can be used in another way.
Instead of using it to translate, you can use it to change the text you don't like.

For more details, you can look here : http://drupal.org/node/58610

For the date format, i don't know :/
And for the "global structure" try looking into the theme chapter.

amnon’s picture

For the date format, i don't know :/

You sould have done that in the settings page (it's the 'medium' date format which is used), but I don't see a posibility to remove the HH:MM field :-(

So you'll have to edit your theme. Open 'node.tpl.php' and change:

    <span class="submitted"><?php print $submitted?></span>

to:

   <?php if ($submitted) { ?>
    <span class="submitted">
        <?php
            print 'by ' . theme('username', $node) . ' | ' . format_date($node->created, 'custom', 'd/m/Y');
            if ($terms) {
                print ' | in ';
            }
        ?>
    </span>
    <?php } ?>
sinker’s picture

Man Amnon, that gets me ALMOST there, but there are some differences between what I'm seeing and what you're seeing.

The theme I'm using doesn't have node.tpl.php in its directory. I assume then that leads me back to the phpTemplate node.tpl.php. And in fact entering what you say does change the wording on my site, so I'm definitely in the right place.

However, you're having me look for this string:

<span class="submitted"><?php print $submitted?></span>

But in my node.tpl.php file I don't have that. The closest thing I have is this:

<div class="info"><?php print $submitted ?><span class="terms"><?php print $terms ?></span></div>

If I comment that line out and insert your code, it does in fact change the "submitted by" line and the date as I want, but it simply says "in" and is blank instead of printing "in Category" as I had hoped. I'm not fluent in PHP enough to know how to stick that $terms in so it works. any help?

Thanks in advance!

trevortwining’s picture

Try changing that to

if ($submitted) {

            print 'by ' . theme('username', $node) . ' | ' . format_date($node->created, 'custom', 'd/m/Y');
            if ($terms) {
                print ' | in ' . $terms;
            }
        


}

Trevor Twining
http://www.trevortwining.info

Trevor Twining
Freelance Drupal Dev
Theme/Modules/Sitebuilding

sinker’s picture

That's it! Man, thanks so much everyone.

omnyx’s picture

this doesn't work for freetagging. I.e. it messes up the display for taxonomy terms (tags) that come after the user name and date...
any ideas?

thanks!

nd_cer’s picture

If you're looking to change the username and date for comments add the following code to comment.tpl.php. Change the prefix and the date format to what suits you best. Hope this helps someone!

<?php
 if ($submitted) { ?>
<?php
	print 'by ' . theme('username', $comment) . ' on ' . format_date($comment->timestamp, 'custom', 'j M, Y');
	if ($terms) {
		print ' | in ' . $terms;
		}
?>
<?php
	}
?>
allen074’s picture

this code is great, thank you -- how can i make it so that the username is not a link but just shown?

print 'Posted by ' . theme('username', $node) . ' | ' . format_date($node->created, 'custom', 'm/d/Y');

I want it to say Posted by Allen but the Allen should not be a link.

Thanks,
Allen

allen074’s picture

anyone know? thanks

lakyljuk’s picture

AFAIK only logged users can see author's name as a link, not logged users always see only simple text.

simplymenotu’s picture

In 4.7 if you allow Anonymous users to "access user profiles" they will be able to click the link (along with bots/spiders/bears/tigers/oh my!)

-simplymenotu

dvkd’s picture

Hi nd_cer,

Can you please tell me how to display tags in this format:

in: tag1 | tag2 | tag3

Thanks in advance

jweedman’s picture

Worked Perfect. Thank you.

seanbfuller’s picture

You might also want to look at phptemplate_comment() and phptemplate_node() in phptemplate.engine to see how to do it while keeping translations and settings:

For nodes (node.tpl.php):

  if (theme_get_setting('toggle_node_info_' . $node->type)) {
    $new_submitted =  t('Submitted by %a on %b.', array('%a' => theme('username', $node), '%b' => format_date($node->created)));
  }

For comments (comment.tpl.php):

    $new_submitted = t('Submitted by %a on %b.', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp)));

Same basic thing as above, but this has a few more pieces. I had to go hunt this down with these requirements, so I thought I'd share.

--------------------
Sean B. Fuller
www.seanbfuller.com
www.tractiv.com

--------------------
Sean B. Fuller
www.seanbfuller.com

giorgio79’s picture

amir_khakshour’s picture

try:

function phptemplate_node_submitted($node){
/** 
* return t('Submitted by !username on @datetime',
*   array(
*      '!username' => theme('username', $node),
*      '@datetime' => format_date($node->created),
*    ));
* }
*/

within template.php to get what you want with overriding default node_submitted theme in node.module

ericjam’s picture

Could you add the taxonomy part to the code above?

kevcol’s picture

http://drupal.org/project/submitted_by

Making my life much simpler

danny_joris’s picture

Awesome ! :)

peacho’s picture

Thanks for the link to a great module. Works exactly as I needed it to!