I am using Danland 7. x.1.0 with Drupal 7.o together with Panels 7.x 3.0-alpha3.
I get "published by [username] on [date] [time]" at the head of each article and panel. How can I remove it.
Looking through the code I see that it is controlled by variable $display_submitted (node.tpl.php line 14):

 <?php if ($display_submitted): ?>
    <div class="meta submitted">
      <?php print $user_picture; ?>
      <?php
        print t('published by !username on !datetime',
          array('!username' => $name, '!datetime' => $date));
      ?>
    </div>
  <?php endif; ?>

I can see nowhere, either in this file or the whole of the Drupal folders where $display_submitted is either initialized or referenced!

I found an old messge relating to this subject which told the originator to change a setting in themes>global settings. However, that message related to Drupal 6 and I can see no settings in Drupal 7 relating to this, either in the Global settings or in the Danland specific settings!
How can I change it in Drupal 7 /Danland 7 so that 'Published By..' is not displayed?

Comments

danpros’s picture

Hi,

How if just removing this in node.tpl.php

  <?php if ($display_submitted): ?>
    <div class="meta submitted">
      <?php print $user_picture; ?>
      <?php
        print t('published by !username on !datetime',
          array('!username' => $name, '!datetime' => $date));
      ?>
    </div>
  <?php endif; ?>

Dan

Peters196’s picture

That doesn't appear to work!
As an alternative to deleting it, is is possible to move 'Published By...' to below the body, rather than between the title and the body?
Is is possible, also, to reduce the ammount of white space (about four or five lines of it) above the body? (between the normal position of 'Published by..' and the body)

danpros’s picture

Status: Active » Fixed

Hi,

I try to remove that in my PC and its work :) try to reload the page. You can move that by print this else where

  <?php if ($display_submitted): ?>
    <div class="meta submitted">
      <?php print $user_picture; ?> <!-- print the user picture, do not move if you want the picture displaying on the top -->
      <?php
        print t('published by !username on !datetime',
          array('!username' => $name, '!datetime' => $date));
      ?>
    </div>
  <?php endif; ?>

Dan

dru.paul’s picture

for those using Drupal 7.2

changing 1st occurence of
$variables['display_submitted'] = TRUE;
to
$variables['display_submitted'] = FALSE;
in
drupal7/modules/node/node.module
as shown below works for me.

  // Display post information only on certain node types.
  if (variable_get('node_submitted_' . $node->type, TRUE)) {
    //$variables['display_submitted'] = TRUE;
    $variables['display_submitted'] = FALSE;
    $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
    $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : '';
  }
  else {
    $variables['display_submitted'] = FALSE;
    $variables['submitted'] = '';
    $variables['user_picture'] = '';
  }

or if leave as TRUE can change what is printed by altering the

$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));

line.

rotarydial’s picture

Thanks, dru.pal. This worked for me. Question though... does it count as hacking core?

sboots’s picture

Seconded - thanks dru.paul! Worked perfectly.
To rotarydial, nope, that doesn't count as hacking core! By pasting dru.paul's second code block into your theme's template.php file, I think you're using Drupal 7's theme system exactly as designed. It'll look something like,

function THEMENAME_preprocess_node(&$variables) {
  if ($variables['submitted']) {
    $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
  }
}

If you'd like to use a different date format, you can use something like the example here: http://drupal.org/node/1072640#comment-4382014

function THEMENAME_preprocess_node(&$variables) {
  if ($variables['submitted']) {
    $variables['submitted'] = t('Posted on !datetime', array( '!datetime' => format_date($variables['node']->created, 'custom', 'l, F j, Y')));
  }
}

All the best!

danpros’s picture

Hi,

drupal7/modules/node/node.module

What dru.paul did is hacking the Drupal core, and I am hacking the theme core, ups! :D

If you want re-order the placement than you can change it via node.tpl.php, using template.php is the best solutions if you want to change words, date system etc.

Dan

sboots’s picture

Ah, touché - thanks Dan! You're right. I only looked at the very last line of dru.paul's post. : ) Agreed - template.php seems to be the best place for these changes.

Cheers! : )

alesr’s picture

To disable "Submitted by ..." text in Drupal 7 for a custom content type, go to structure -> content types -> edit and in "Display settings" tab uncheck "Display author and date information" checkbox.

No need to write code for this.

danpros’s picture

Status: Fixed » Closed (fixed)

Hi alesr,

Thanks for the hint, yes like on D6. The poster write a code so we all thinking if he want completely remove it :)

cord1’s picture

Interesting discussion.
I am creating a module, creating a new contenttype which I populate with nodes in the *.install file.
Seems there is no possibility to set the publishing-, display-, comment- or menu-options before populating with nodes without "hacking" the core.

I think this should be a part of options like $node->comment, $node->promote and $node->sticky is.
If not you have to hack the core I think.

Or do anyone else know a another way?

This is moved to http://drupal.org/node/1277730

rob1pcs’s picture

Unless I don't understand the problem (I don't use Danland or panels), can you not just turn this off through the content type settings?

Peters196’s picture

When I first submitted this issue I was still feeling my way around Drupal and Danland.
In my case the 'mansge Display' settings in Content type has done what I needed, so, as far as I am concerned the issue is fixed!
However, some of the other posts to this topic seem to raise more complex issues which may (or may not) need more in-depth investigation. Could I suggest that if anyone still has an un-answered problem on their version of this issue that they submit it as a new issue.
Thanks to everyone who suggested possible solutions to my problem.
Peters196

abhinya’s picture

ref: alesr
Structure>content type>"content type, ex: book">display settings> uncheck "Display author and date information. "

That's the best way to do it.
Many times code edits without fully understanding the consequences and relative changes could be a bit uncomfortable at a later stage of development.
Regards,
Abhi Kalyan

tax14’s picture

Ref alesr's comment on August 1, 2011 at 12:24pm

To disable "Submitted by ..." text in Drupal 7 for a custom content type, go to structure -> content types -> edit and in "Display settings" tab uncheck "Display author and date information" checkbox.

This works for custom content types as well as the default content types (Article and Basic page), at least in Drupal 7.

dianacastillo’s picture

in drupal 6 you do it here in the admin page ?q=admin/build/themes/settings you can disable these per content type

fazal_rkmp’s picture

in my site i have different admin for different region. who can approve the content in there own region.
Now my problem is i want to add Approved by "Admin Name" to the "Submitted by " line which is available below the title of every node.
Please tell me is it possible.

Yet Another User’s picture

#9 Alesr's answer worked for me :)
Thanks +1

mmomin’s picture

Issue summary: View changes

How can I display Author's position as well?? I meant "Blogger" or a "manager" etc..

MartinMa’s picture

It would be great to uncheck Display author and date information" on the different view modes pages ...