By xaryss on
The title basically says it all, but just to sum it up again. I want to have polls on my front page and I want anonymous users to be able to vote, but I really don't want the "old polls" link at the bottom of the poll. I do not want users to be able to go back and see the previous polls. Is this a CSS change or did I miss something in the setup of the poll?
Oh, and while I am at it. Does anyone know how to remove or better yet change the title of the poll? By default it is just "poll". I would like it to say something different or maybe even a graphic. Any help would be appreciated!
Thanks a lot,
Luke
Comments
Yeah anyone? I also want to
Yeah anyone? I also want to get rid of that link or change it to something else... Thanks...
change polls title in block config
I think this is done in block config. Add the title you want to appear in the title space. That said it still doesn't change the title when you click to look at full page - reverts back to just Poll
title of poll you change it
title of poll you change it in blocks, find the block 'most recent polls' configure and change it to whatever you want!
Not sure about the link tho...
Yeah thats the way to change
Yeah thats the way to change the title. But how about the 'older polls' link?
code Change Needed
in your /modules/poll directory
file poll.module
comment out this line:
// $links[] = array('title' => t('Older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));
that's it.
That isn't Drupal way
Although your solution works, it is not the best way. When you update your core you are overriding the file you have changed, so your modification will be lost.
To solve this problem I recommend you to upload poll-results.tpl.php and poll-results-block.tpl.php (which are in /modules/poll directory) to your theme folder. There you can change them (removing the links div in poll-results-block.tpl.php, for example).
And remember, you should never modify a Drupal core files if you don't want to lose your changes in the future.
How to ?
After more than 1 year, would you tell me how to remove it in poll-results.tpl.php and poll-results-block.tpl.php ?
Removing Older polls link from the poll block
Remove the line:
<div class="links"><?php print $links; ?></div>from modules/poll/poll-results-block.tpl.php
This solution works but it is not so good, because you must be carefull when update your core.
Sorry for answering so
Sorry for answering so late... Although commenting out links line should work as dragan_r said it is not recommended to hack drupal core files (if you update your core you override those files, so changes will be lost). The easiest way to remove the old polls link, should be: copy the files you want to modify to your theme root directory (drupal_home/sites/all/your_theme) and modify them there (comment out links line).
Drupal 6.X
I am dense
Where do you put the above code?
Also, how do you turn the poll title in the block into a link to the poll page?
All the solution above only
All the solution above only explain how to get rid of the links in the result block.
Is it possible to remove then without hacking into the module ?
After some search i saw that in the function poll_block_latest_poll_view of poll.module ( in drupal 7 )
the links are added that way :
D7 hack
Considering the code above you just have to replace the last line with
$node->links = FALSE;
I could not find a way to do this without changing core files. The function poll_block_latest_poll_view puts the $links variable inside $node. I guess that in this case the only way not to output links is to set it to false before it gets into $node... in the core files.
The solution without hacking
The solution without hacking is this (hacking core is BAD):
And you can override poll-results--block.tpl.php for the links on the results block.
Thanks :)
Thanks :)
if (in D7) you only want to
if (in D7) you only want to remove the "Older polls" links and leave the "results" link, use:
unfortunately when the poll
unfortunately when the poll has been submitted the link becomes part of the full complete html output inside $data['content']['#markup'] :(
Thanks @rooby for the
Thanks @rooby for the tip.
This hook hook_block_view_MODULE_DELTA_alter() is vey useful for my current bug.
:)
http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio...
More configuration options
What about squeezing a tad more configuration options in the module? Wouldn't save a lot of time?
Issue queue feature request
This is not the right place for feature requests, so nothing will happen from asking here.
You need to post a feature request in the issue queue for the module.
In this case drupal core.
In D7, How can we remove the
In D7, How can we remove the "older polls" and the votes count on the result bloc?
you can override theme_links()
If you want to get rid of the links on the results block you can override a special subset of theme_links like this:
But it will still leave the surrounding links div.
This is what I did too, but it doesn't work
This is what I did too but it doesn't work for the results block, only the poll itself. For the results you'll have to also override theme_links() like so:
It will still leave the surrounding links div.
Thanks, @rooby
Thanks, @rooby
I created a view to replace the 'recent poll' view.. seemed easy
in Drupal 7 to use this block/panel without displaying the 'older polls' link I:
-------------------------------------
- Created a new View (Content pane)
- format Unformatted list
--Show: Rendered Entity - Full Node
Filter
- Content: Type = Poll
Sort
- Post Date
Allow Settings: Some
- Check Link to view, More link, Path override, Title override, Use exposed widgets.... +- whatever you feel like. it makes those options available from the panel pages if you're using panels.
Pager
- Display a specified number (1)
-------------------------------------
I also have comments and printer friendly and display author disabled for polls.... this method worked well for me without any coding
I teach live project-based Drupal Training courses at Debug Academy.
I provide performant affordable Drupal hosting for smaller sites with automatic upgrades at Drupito.
Thank you
This is a creative way.
And clear cache
Note you may also need to clear cache after updating template files at admin/config/development/performance
An easier way
I simply added this CSS code to my style.css file, which makes all the links on the polls (and only those links) disappear:
another way..
You can also copy the "poll-results--block.tpl.php from the poll module and copy it into your theme folder. From there you can remove or comment out the
div class="links">
print $links;and that should do the job as well. That way you won't be overriding core.
Oh thank you.
Worked like a charm.
String Overrides
Another method I just discovered is if you have the String Overrides module installed you can enter 'Older polls' and then leave the replacement string blank, and the Older polls link will not appear.