Hi there,jasolo wrote: Sat Nov 10, 2018 7:23 pm The following code should work. In core/advancedpolls.php, before the comment "// Okay, lets push some of this information to the template", insert this:Code: Select all
for ($i = 0; $i < $poll_options_count; $i++) { $poll_options_template_data[$i]['POLL_OPTION_PERCENT'] = $poll_options_template_data[$i]['POLL_OPTION_RESULT'] / strtr($poll_options_template_data[$i]['AP_VOTERS'], array('(' => '', ')' => '')); }
Thank you for the quick reply. It is not being taken for granted and I really appreciate it.jasolo wrote: Sun Aug 14, 2022 10:09 am I won't be available until September. You should activate the debugging in phpBB and check the server logs to know what causes the blank page.
833 is one of the lines where the changed code is (the one you recommended).[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 833: A non-numeric value encountered
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 833: Division by zero
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 833: A non-numeric value encountered
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 833: Division by zero
Code: Select all
// Add the button to see poll results, if you have permissions
if ($this->auth->acl_get('m_seevoters', $topic_data['forum_id']))
{
$poll_template_data['U_AP_POLL_INFO'] = $poll_template_data['S_POLL_ACTION'] . '&view=infopoll';
}
for ($i = 0; $i < $poll_options_count; $i++)
{
$poll_options_template_data[$i]['POLL_OPTION_PERCENT'] = $poll_options_template_data[$i]['POLL_OPTION_RESULT'] / strtr($poll_options_template_data[$i]['AP_VOTERS'], array('(' => '', ')' => ''));
}
// Okay, lets push some of this information to the template
That would also be fine for me, it would be just great to have any kind of solution for this. I'll write cachete, maybe he can tell me his changes in the code.After that post, Cachete contacted me by private message and I suggested him where he could find the solution, but that was months ago and I don't have his code. I think he was changing the extension to show only the averages, not as an additional option.
Code: Select all
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
Code: Select all
$vote_counts[$option] += (int) $voted_val[$option];
Code: Select all
$sql = 'SELECT COUNT(vote_user_id) AS votersforoneoption
FROM ' . POLL_VOTES_TABLE . '
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $topic_data['topic_id'];
$result = $db->sql_query($sql);
$votersforoneoption = (int) $db->sql_fetchfield('votersforoneoption');
$db->sql_freeresult($result);
$vote_counts[$option] = ($vote_counts[$option] + $voted_val[$option]) / $votersforoneoption;
Code: Select all
$vote_counts[$option] = ($vote_counts[$option] + $voted_val[$option]) / 2;
Code: Select all
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 717: Undefined array key "total_user_votes"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Trying to access array offset on value of type null
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 717: Undefined array key "total_user_votes"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "username"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "user_colour"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Undefined array key "username_clean"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "username"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "user_colour"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Undefined array key "username_clean"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "username"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "user_colour"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Undefined array key "username_clean"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "username"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 713: Undefined array key "user_colour"
[phpBB Debug] PHP Warning: in file [ROOT]/ext/wolfsblvt/advancedpolls/core/advancedpolls.php on line 715: Undefined array key "username_clean"
It would appear that this extension is not compatible with PHP 8.1.
The problem is the same on php8.0 and php7.4 will be deactivated by my hoster on 14. November 2022.
On my board with php 8.0.20 and all other extensions deactivated the problem is the same.SeewolfPK wrote: Fri Sep 09, 2022 7:34 am Version 1.2.4.1 - phpBB 3.3.8 - php 8.0.20
is installed and works fine