I'm using 4.6 and friendselectric theme running on the PHPtemplate engine. I was wondering if there was an easy way to choose whether a post would have the authors name and date/time stamp below it or not when it is published.

I can take out the print call in "node.tpl.php" to make it so none of the nodes have the author and date, but I was hoping there would be a way to choose this option during authoring the node.

Ideally, I could set it so some users, anonymous lets say, have to have their names and time show up, but others, like admins, could take it away.

Any ideas?

Thanks in advance,
-Adam

Comments

sangamreddi’s picture

Make a copy of node.tpl.php and rename it node-page.tpl.php or something else and the remove the print call from the file. that's it.

You give permissions of story module to users so that their post consists of author and time stamp.

You use page module for the posting so u won't be having the author and time stamp.

Note:This trickc applies to every node, i mean node-story, node-forum, node-weblink, node-image, noe-blog etc.

Cheers,
Sunny
www.gleez.com

acostanza’s picture

Now that is amazing! I've got a lot more to learn about PHP :)

Thanks for the tip!
-Adam

www.ratetheworld.com

sangamreddi’s picture

Thank You

Sunny
www.gleez.com

jeforma’s picture

is there a way to take it off of the Interlace theme?? I really hope so...

sangamreddi’s picture

I think it's not possible like i explained above.
if want to remove it for every node it can be possible and simple.

If u can delete the line starting form 134 - 153 ( span class="nodedate - output = span) from interlaced.theme file that's it.

U won't get the submitted and date on every node.

If you can convert the theme to php tempalte based theme is another way. I don't about the other possiblities.

Sunny
www.gleez.com

jeforma’s picture

thanks for the help, thats what i thought also ;)

sangamreddi’s picture

bonobo’s picture

to go to admin/themes/settings

You can choose to display or hide the "submitted by Username on date" text for every node type.

This works with every theme, whether phptemplate based or xtemplate based.

This is a blanket solution, however -- it does not give individual users the option to display this info.

Cheers,

bonobo
-------
http://www.funnymonkey.com
Tools for Teachers

sangamreddi’s picture

It's not working perfectly with every theme.

few custom themes it didn't work at all.
contributed themes i have checked it long back not worked with every theme.

Sunny
www.gleez.com

Erin_ARC’s picture

Thank you bonobo! It worked perfectly :-)

freyquency’s picture

wwwoliondorcom’s picture

Hello,

I'm using MARVIN template but I can't find the files for this THEME on the THEMES folder (but I see bluemarine, chameleon, etc...) so I don't know how to get rid of the time and author stamp ?

I know how to do it when I can find the NODE.TPL.PHP but as I find no files for marvin... ?!

Thanks.

caprenter’s picture

The marvin theme can be found within the chameleon theme (i.e. inside that directory in the default installation)

The code that drives marvin is found in the chameleon.module file (open it with a text editor to see it)

BUT, to control the author settings in this theme see the post above from bonobo.

administer - themes - configure (by the theme you use) - Look for 'global settings' near the tabs at the top of this page, and the author settings for each node are there.

Hope this helps

darumaki’s picture

is it possible to remove only the time part of the date ?

max29italy’s picture

hi,
is possible to modify node.tpl.php as follow

<?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created, 'custom', 'D, d/m/Y'))); ?>

Here's what this displays: Fri, 23/11/2007 submitted by xyzxyz

For all code in order to format as you want date please see at
http://us3.php.net/manual/en/function.date.php

darumaki’s picture

how about formating the Forum date stamp, that one appears separate from the main one

aac’s picture

Thanks for the code!!

---~~~***~~~---
aac

tobyk’s picture

Sunny, Thanks for that page template trick. Very helpful for simple page display modifications.
Is that hint documented anywhere?
--Toby

mikebrooks’s picture

In case anyone stumbles across this old thread. We recently had a request from a Drupal 6 customer to provide a means to disable Author & Post date for specific nodes.

  1. We enabled the CSS Injector module.
  2. Created a Rule named "Hide Posted date on select nodes"
  3. Added the CSS code .submitted {display:none;}
  4. Configured "Add the CSS on specific pages:" to "Add on only the listed pages." and entered the paths in the Pages text area.

Now the non-technical admin can just add and remove paths to disable the display of the submitted data.

sjk1000’s picture

Definitely good to know that CSS Injector exists but this doesn't remove the "author" and "time" specifically as requested - it removes the entire submitted field.

sjk1000’s picture

Assuming your subtheming, copy the node.tpl.php file from your main theme. In omega this in in omega/themes/templates/node

Paste this file into your theme's template folder so it looks like this

yourtheme/templates/node.tpl.php

Find the code in node.tpl.php that looks like this [as seen in omega, assume it's similar in other themes]:
<p class="submitted"><?php print $submitted; ?></p>

Replace it with

 <?php if ($submitted) { ?>
        <div class="date">
          <span class="day"><?php  echo "Posted on ". date("l jS \of F Y", $node->created); ?></span>
      </div>
  <?php } ?>

This will then show:
Posted on Friday 25th of April 2014

Replace the "Posted on " or the double-quoted section in date(" ") with whatever you like from the php manual examples here

Thanks to Danny Englander for providing the fundamentals

sjk1000’s picture

Without any coding, if you’re using display suite. With Date module installed.

Set up a new Date Format
Go to Configuration > Date and Time
Select the Formats tab in top left
Add a for such as
\P\o\s\t\e\d\ \o\n l jS \of F Y

The first part will produce “Posted on”
The second part (l jS \of F Y) will produce "Friday 25th of April 2014”
i.e. Posted on Friday 25th of April 2014”
Click Add Format

Go back to the Date and Time > Type tab
Click Add Date Type, give your date type a name, e.g. “Friendly Date". In the Date Format dropdown, your new format should be at the bottom of the list, e.g. Friday 25th of April 2014

Add the Post Date to your Content Type
For the content type your working with e.g. Article, go to the Edit tab and deselect "Display author and date information”. Press Save
Then go to the Manage Display tab.
Go to Custom Display Settings and tick the view modes you want to see e.g. Full Content and Teaser. Press Save
Go to Full Content, or whatever view mode you created
If Display Suite is enabled, it should say Layout for article in Default. Choose a One Column layout to keep things simple. Press Save
You should now have a lot more fields available to add to your content type. Drag Post Date up to the Content section.
In the format box for Post date you should see your date format (e.g. “Friendly Date”) that you created above with your custom text. Press Save
Your content for that content type should now display your "Posted on …” date field at whatever position you dragged it to.

I find this method easier for customisation. I can produce multiple date format to say what I want and reuse them, but I’d like to know how to get to the post date field without using a Display Suite layout.

CsarGabriel’s picture

navigate to: structure/content types/->(edit)/Display Settings and un-check "Display author and date information."
in Drupal 7

koolkop’s picture

Thanks for this amazing info!