Poll Block Modification
Philipp Esselbach
From: -
Editor
0From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Poll Block Modification
Philipp Esselbach
OP
From: -
Editor
0From: -
You could replace:
with:
to show the number of votes.
if( $input_poll_choice )
{
$news_poll .= "<input type=\"checkbox\" name=\"input_votes[]\" value=\"".$insert['poll_option_id']."\" />".$insert['poll_option']."<br />";
}
else
{
$news_poll .= "<input type=\"radio\" name=\"input_vote\" value=\"".$insert['poll_option_id']."\" />".$insert['poll_option']."<br />";
}
with:
$y = $i - 1;
if( $input_poll_choice )
{
$news_poll .= "<input type=\"checkbox\" name=\"input_votes[]\" value=\"".$insert['poll_option_id']."\" />".$insert['poll_option']." (" . $input_results_array[ $y ] . " votes)<br />";
}
else
{
$news_poll .= "<input type=\"radio\" name=\"input_vote\" value=\"".$insert['poll_option_id']."\" />".$insert['poll_option']." (" . $input_results_array[ $y ] . " votes)<br />";
}
to show the number of votes.
1 Re: Poll Block Modification
ReviewStud 135
From: -
From: -
Just wondering, but how can you see the poll results without voting? I didn't see them on the news story's article.
1 Re: Poll Block Modification
Philipp Esselbach
OP
From: -
Editor
0From: -
I found the problem. The script is using $query in the follow part:
Just replace $query with $result2 or something else
if( $preferences[ 'news_allow_unregpolls' ] or $user[ 'user_status' ] )
{
if( $user[ 'user_status' ] )
{
$query = $database -> dbquery( "SELECT newspoll_id FROM " . DB_PREFIX . "esselbach_ct_newspolls WHERE newspoll_story = '" . $newsstory_id . "' and newspoll_user = '" . intval( $user[ 'user_id' ] ) . "'" );
$voted = $database -> dbrows( $query );
}
else
{
$uniqueid = md5( $_SERVER[ 'HTTP_USER_AGENT' ] . $system -> getip() );
$query = $database -> dbquery( "SELECT newspoll_id FROM " . DB_PREFIX . "esselbach_ct_newspolls WHERE newspoll_story = '" . $newsstory_id . "' and newspoll_uniqueid = '" . $uniqueid . "'" );
$voted = $database -> dbrows( $query );
}
}
Just replace $query with $result2 or something else
1 Re: Poll Block Modification
error 232
From: -
From: -
Strange. Tried that. Doesn't work.
1 Re: Poll Block Modification
ReviewStud 135
From: -
From: -
Error, I got the same error. Philipp is right. Simply select "Clear Cache" and everything will be set back to normal.
Nice blocks modification Philipp. Love it!!
Nice blocks modification Philipp. Love it!!
1 Re: Poll Block Modification
Philipp Esselbach
OP
From: -
Editor
0From: -
I just tried it on another installation and it works fine there as well. Perhaps it is a caching issue? What happened if you clear the cache by clicking "clear cache" in admin control panel? The old news poll is working fine?
1 Re: Poll Block Modification
Philipp Esselbach
OP
From: -
Editor
0From: -
Odd. I will look into it.
1 Re: Poll Block Modification
error 232
From: -
From: -
No, i can see news stories. Just blocks disapears? I can see only poll block.
1 Re: Poll Block Modification
Philipp Esselbach
OP
From: -
Editor
0From: -
Blank screen?
1 Re: Poll Block Modification
error 232
From: -
From: -
Something is wrong with modification. When I replace news_poll and edit template all my blocks disapear.
As requested by Error, this modification of the news poll block allows your visitors to vote directly from the poll block rather then going to the news story page.
To redirect back to the main page after the vote, you need to do the following modifications in template news_story_poll_voting_done:
news_poll_mod.zip