Please or Register to create posts and topics.

Polls – give a random order of answers.

Hello.

Polls – give a random order of answers.

When you create a survey. And you write answers in a row:
1
2
3
4
5
6
(I created 6 answers, maybe the quantity somehow affects.)

Then, when you save the topic, the survey answers are sometimes given randomly:
5
1
2
3
4
6

Or backward – forward (which is also bad):
6
5
4
3
2
1

How to put things in order? I need the answers to be shown in the order in which I entered them. šŸ™

Hey @sea34,

it seems like there is an error. Can you please write a debug log and share the errors here. You can activate it by following this guide:

https://help.dreamhost.com/hc/en-us/articles/360029327771-Enabling-the-WordPress-Debug-log

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

Is this error just for me, or for the plugin as a whole??

I will not be able to provide you with any data. This is all too complicated and incomprehensible for me .. (

We’ll have to torment ourselves with such polls. I will swap them after publication.

Hey @sea34,

usually, the answers of the polls stay at the same position. The order is not changing after saving them. So I guess there is a problem on your website. But I can only help you if I can get further information.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

Hello @sea34

Can you check if the following modification fix the issue?

OpenĀ /wp-content/plugins/asgaros-forum/includes/forum-polls.php. Replace lineĀ 491 with the following:

$poll->options = $this->asgarosforum->db->get_results("SELECT po.id, po.title, (SELECT COUNT(*) FROM {$this->asgarosforum->tables->polls_votes} AS pv WHERE pv.option_id = po.id) AS votes FROM {$this->asgarosforum->tables->polls_options} AS po WHERE po.poll_id = {$poll->id} ORDER BY po.id ASC;", 'OBJECT_K');

Let me know, if the issue is solved afterwards so I can include this fix in the upcoming update.

Sea34 has reacted to this post.
Sea34
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on February 17, 2021, 9:47 am

Hello @sea34

Can you check if the following modification fix the issue?

OpenĀ /wp-content/plugins/asgaros-forum/includes/forum-polls.php. Replace lineĀ 491 with the following:

$poll->options = $this->asgarosforum->db->get_results("SELECT po.id, po.title, (SELECT COUNT(*) FROM {$this->asgarosforum->tables->polls_votes} AS pv WHERE pv.option_id = po.id) AS votes FROM {$this->asgarosforum->tables->polls_options} AS po WHERE po.poll_id = {$poll->id} ORDER BY po.id ASC;", 'OBJECT_K');

Let me know, if the issue is solved afterwards so I can include this fix in the upcoming update.

Yes, with the new code everything works as it should +++

Thanks for the feedback @sea34

I will include the fix in the upcoming update!

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!