Guest User

Untitled

a guest
Jul 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. /**
  3. * @file
  4. * TODO: Removes the "Login to post comments" from posts promoted to the frontpage.
  5. */
  6.  
  7. /**
  8. * Implements hook_node_view().
  9. */
  10. require_once(DRUPAL_ROOT . '/modules/node/node.module');
  11. function hide_login_post_comments_node_view($node, $view_mode) {
  12. // For anonymous users, use a watchdog statement.
  13. watchdog('fix', '<pre>'.print_r($node->content['links']['comment']['#links']['comment_forbidden'], TRUE).'</pre>');
  14. // Tell it which view_mode to change, 'full', 'teaser', etc.
  15. if($view_mode == 'full' || $view_mode == 'teaser') {
  16. // Take out the link by unsetting it.
  17. unset($node->content['links']['comment']['#links']['comment_forbidden']);
  18. }
  19. }
Add Comment
Please, Sign In to add comment