Getting Rid Of Drupal Poll Links

Drupal logo
This article is about a cosmetic change that was needed in showing poll nodes. If you ever seen Drupal poll nodes, you probably weren't too fond of the links that are shown below the poll. Here is how to remove them.

Have Poll Links. Will Travel.

Coding extra links and information into a widget block is a poor decision by many Drupal module developers. In building any module, it is best to keep things as simple and minimal as possible.

Here's a perfect example of what I'm talking about.

Drupal poll links

Look at those ugly links. What was the module developer thinking? Older polls? To understand why this is a terrible design decision, imagine that this node was a blog entry. You don't see "older blog entries" as a link in blog nodes do you?

In addition, the "login or register to post comments" is silly. A poll is a visual element with questions and a vote button. It also is a chart showing the results. Thats all. Registering is a ridiculous link for a poll node. Again, ask yourself if this was a blog node why is there a register link here. Posting comments on a poll node is silly as well. The vote is the comment and there is nothing else left to be said. Leave that to a blog, page, or story content type. Use the poll to supplement those types of pages.

So given this rationale, I decided to get rid of these hideous links because they made my websites look horrible. Here is what I did.

First, lets get rid of the "Older polls" link. Edit the poll.module:

  // Comment this out in function poll_view
  // $links[] = array('title' => t('Older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));

Next, lets edit the comments.module to get rid of the "Login or register to post comments" link:

  //  Comment this out in function comment_link
  //      $node = node_load($comment->nid);
  //  $links['comment_forbidden']['title'] = theme('comment_post_forbidden',$node);

  // Comment this out in function comment_links
  //  $links['comment_forbidden']['title'] = theme('comment_post_forbidden',

I have looked at my content types after making these changes and see no problems. I have tested this as being an anonymous user, an administrator, and an authorized user.


ASO ad


Filed under: