This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Poll Block Modification


avatar
Philipp Esselbach
Editor
0
From: -
Poll Block Modification

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:

<!-- Template: news_story_poll_voting_done -->

<h1>Done</h1>
<div class="content">
Thanks for voting in this poll.<br /><br />
<script type="text/javascript">
<!--
setTimeout('location.href="https://www.contentteller.com/contentteller{$insert['param_ext']}{$insert['param_ct']}news"',2000);
-->
</script>
Please wait while we transfer you back to the main page or <a href="https://www.contentteller.com/contentteller{$insert['param_ext']}{$insert['param_ct']}news">click here</a> if your browser does not forward automatically.
</div>
<br />

   news_poll_mod.zip

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Poll Block Modification
avatar
OP
Editor
0
From: -
You could replace:

                                             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
avatar
135
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
avatar
OP
Editor
0
From: -
I found the problem. The script is using $query in the follow part:

                    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
avatar
232
From: -
Strange. Tried that. Doesn't work.
1 Re: Poll Block Modification
avatar
135
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!!
1 Re: Poll Block Modification
avatar
OP
Editor
0
From: -
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
avatar
OP
Editor
0
From: -
Odd. I will look into it.
1 Re: Poll Block Modification
avatar
232
From: -
No, i can see news stories. Just blocks disapears? I can see only poll block.
1 Re: Poll Block Modification
avatar
OP
Editor
0
From: -
Blank screen?
1 Re: Poll Block Modification
avatar
232
From: -
Something is wrong with modification. When I replace news_poll and edit template all my blocks disapear.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.