General discussion
Poll bug. How to fix?

I can create a new Topic and add a poll, it works fine.


But when I try to add Poll for already existing my Topic I can't do it. Nothing happens.


So how to fix it when "edit" or how to disable adding a Poll when user want to edit a post?


Thnxsmile smile


I can create a new Topic and add a poll, it works fine. But when I try to add Poll for already existing my Topic I can't do it. Nothing happens. So how to fix it when "edit" or how to disable adding a Poll when user want to edit a post? Thnx:P (wasntme)
edited Oct 19 '22 at 2:16 pm

Hi mate smile


You asked me: how to disable adding a Poll when user want to edit a post?


Go to admin backend


  • klick on Rolle Permissions
  • now edit the User permissions like you want (poll settings are at the very bottom)

Kind regards, WebCrew smile


Hi mate :) **You asked me**: _how to disable adding a Poll when user want to edit a post?_ Go to admin backend - klick on **Rolle Permissions** - now edit the **User** permissions like you want (poll settings are at the very bottom) Kind regards, WebCrew ;)

https://net-twin.de/ Community for creative people - JOIN
https://github.com/WebCrew My GitHub account
https://prattle.space A niceTwitter alternative - JOIN
https://sell-co.de/ Lots of Tools and Utilities for free

edited Oct 21 '22 at 1:21 am

@WebCrew thx for quick answr.

But you misunderstood the bug.


Here is my User permissions:


635149e033351


So the bug is next:


Try to edit your post https://codologic.com/forum/index.php?u=/topic/13592/link-to-freichat-documentation-is-dead


and add a Poll. You can do it. But the Poll will not appearsmile


@WebCrew thx for quick answr. But you misunderstood the bug. Here is my User permissions: ![635149e033351](serve/attachment&path=635149e033351) So the bug is next: Try to edit your post https://codologic.com/forum/index.php?u=/topic/13592/link-to-freichat-documentation-is-dead and add a Poll. You can do it. But the Poll will not appear;)

Now I understand you well, smile we'll ask the team about it, because it could either be an error, or it's intended that you can't add polls to a topic afterwards.


@admin and @adesh would you be so kind and explain it to him please.

Kind regards, WebCrew smile


**Now I understand you well**, :) we'll ask the team about it, because it **could either be an error, or it's intended that you can't add polls to a topic afterwards**. @admin and @adesh would you be so kind and explain it to him please. Kind regards, WebCrew ;)

https://net-twin.de/ Community for creative people - JOIN
https://github.com/WebCrew My GitHub account
https://prattle.space A niceTwitter alternative - JOIN
https://sell-co.de/ Lots of Tools and Utilities for free

it's intended that you can't add polls to a topic afterwards.


yepsmile


[quote="pid:26113, uid:8261"]it's intended that you can't add polls to a topic afterwards.[/quote] yep:P

This seems like a bug. We have noted it down and will decide on the correct fix in the next version.


This seems like a bug. We have noted it down and will decide on the correct fix in the next version.
Necessity is the mother of all inventions!

This seems like a bug


Okay. This is what I do and get some results


Edit file -> ...\sys\Controller\Ajax\forum\topic.php


We need to find -> public function edit()


Then find a line -> $topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']);


and Add next code:


if ($_POST['has_poll'] == 'yes'smile {
$topic->addPollToTopic($tid, $_POST['poll_title'], $_POST['poll_data']);
}


Now users can add a poll to old post and even Edit, but have errors like that when Edit:


6357dbd030138


As I understand that error means we dublicate our data twice.


I want to Add "IF / Else" to check If Poll Exists or Not Exist, but I can't do it myselfsmile


For example I need like that:smile
$topic->addPollToTopicIfNotExists($tid, $_POST['poll_title'], $_POST['poll_data']);
$topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']);


@admin help please. I don't want to wait for next releasesmile

[quote="pid:26137, uid:1"]This seems like a bug[/quote] Okay. This is what I do and get some results Edit file -> ...\sys\Controller\Ajax\forum\topic.php We need to find -> **public function edit()** Then find a line -> **$topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']);** and Add next code: if ($_POST['has_poll'] == 'yes') { $topic->addPollToTopic($tid, $_POST['poll_title'], $_POST['poll_data']); } Now users can add a poll to old post and even Edit, but have errors like that when Edit: ![6357dbd030138](serve/attachment&path=6357dbd030138) As I understand that error means we dublicate our data twice. I want to Add "IF / Else" to check If Poll Exists or Not Exist, but I can't do it myself(:| For example I need like that::D $topic->addPollToTopic**IfNotExists**($tid, $_POST['poll_title'], $_POST['poll_data']); $topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']); @admin help please. I don't want to wait for next release:S
edited Oct 25 '22 at 1:58 pm

@John Wick smile

Patience my friend Patience please - others are also waiting for updates, the Codologic team is small, consists of only two brothers - both are currently working very hard on server updates, the login system and on getting the update of Codoforum ready in the near future and our code warriors also have a private life.


So please again, try to be patient, no one is preferred or disadvantaged here, we always try to be fair to everyone - it would be unfair to the others if you were treated preferentially now. smile

Thank you for your understanding.
smile



By the way what PHP Version are you running and which Codoforum Version?



You can be 100% sure about that the team will update Codoforum as soon as possible, they always do their best mate. smile


Regards, WebCrew smile


@John Wick 8) **Patience my friend Patience please** - others are also waiting for updates, **the Codologic team is small**, consists of only **two** brothers - both are currently working **very hard** on server updates, the login system and on getting the update of Codoforum ready in the **near future** and our code warriors also **have a private life**. So **please** again, try to be patient, **no one is preferred or disadvantaged here**, we always try **to be fair to everyone** - it would be unfair to the others **if you were treated preferentially now**. ;) ** Thank you for your understanding.** :) > By the way what PHP Version are you running and which Codoforum Version? You can be 100% sure about that the team will update Codoforum as soon as possible, they always do their best mate. :) Regards, WebCrew ;)

https://net-twin.de/ Community for creative people - JOIN
https://github.com/WebCrew My GitHub account
https://prattle.space A niceTwitter alternative - JOIN
https://sell-co.de/ Lots of Tools and Utilities for free

edited Oct 25 '22 at 4:10 pm

@WebCrew

All your replies for me are useless.


Why are you doing that?smile


I am here for code only


@WebCrew All your replies for me are useless. Why are you doing that?x( I am here for code only

@John Wick

635b55562bed3



Admin already told you:


This seems like a bug. We have noted it down and will decide on the correct fix in the next version.


I only said "please be a bit patient" there's no need to be rude, either, John!


I've been here for a good 4-5 years now and I'm helping "voluntarily" and you're the very first person who has a problem with it during this time, which doesn't bother me, because I certainly don't like everyone here either, but at least I remain polite and professional.


I know you want "code" and a solution - everyone wants that.


There are thousands of Codoforum users, I use it myself and we all just have to wait for an update.


I already told you that the team at Codologic is small and they are already hardworking beyond measure and striving to always do their best.


So can you please show some understanding as a user for this, right?


Please remain polite, just like us - thank you very much.


Have a nice day. smile


WebCrew smile


@John Wick ![635b55562bed3](serve/attachment&path=635b55562bed3) ** Admin already told you:** [quote="pid:26137, uid:1"]This seems like a bug. We have noted it down and will decide on the correct fix in the next version.[/quote] I only said "**please be a bit patient**" there's no need **to be rude**, either, John! **I've been here for a good 4-5 years now and I'm helping "voluntarily" and you're the very first person who has a problem with it during this time**, which doesn't bother me, because I certainly don't like everyone here either, **but at least I remain polite and professional**. I know you want "code" and a solution - **everyone wants that**. There are **thousands of Codoforum users**, I use it myself and **we all just have to wait for an update**. I already told you that the team at Codologic** is small and they are already hardworking beyond measure and striving to always do their best**. So can you **please** show some understanding as a user for this, right? **Please remain polite**, just like us - thank you very much. Have a nice day. ;) WebCrew :D

https://net-twin.de/ Community for creative people - JOIN
https://github.com/WebCrew My GitHub account
https://prattle.space A niceTwitter alternative - JOIN
https://sell-co.de/ Lots of Tools and Utilities for free

edited Oct 28 '22 at 5:06 am

done! no errors!


Edit file -> ...\sys\Controller\Ajax\forum\topic.php


We need to find -> public function edit()


Then find a line -> $topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']);


and Add new next code AFTER:


$questionData = \DB::table(PREFIX . 'codo_poll_questions as q')
->leftJoin(PREFIX . 'codo_poll_log as l', function($join) {

$join->on('l.poll_id', '=', 'q.id');
$join->on('l.uid', '=', \DB::raw(\CODOF\User\CurrentUser\CurrentUser::id()));
})
->select("q.*", "l.uid")
->where('topic_id', '=', $tid)
->first();


if ($questionData == null) {
if ($_POST['has_poll'] == 'yes') {
$topic->addPollToTopic($tid, $_POST['poll_title'], $_POST['poll_data']);
}
}
done! no errors! Edit file -> ...\sys\Controller\Ajax\forum\topic.php We need to find -> public function edit() Then find a line -> $topic->updatePollIfExists($tid, $_POST['poll_title'], $_POST['poll_data'], $_POST['has_poll']); and Add new next code AFTER: ```` $questionData = \DB::table(PREFIX . 'codo_poll_questions as q') ->leftJoin(PREFIX . 'codo_poll_log as l', function($join) { $join->on('l.poll_id', '=', 'q.id'); $join->on('l.uid', '=', \DB::raw(\CODOF\User\CurrentUser\CurrentUser::id())); }) ->select("q.*", "l.uid") ->where('topic_id', '=', $tid) ->first(); if ($questionData == null) { if ($_POST['has_poll'] == 'yes') { $topic->addPollToTopic($tid, $_POST['poll_title'], $_POST['poll_data']); } } ````
edited Nov 29 '22 at 8:34 pm

@JohnWick thank you very much - that helps a lot smile

@JohnWick thank you very much - that helps a lot ]:)

https://net-twin.de/ Community for creative people - JOIN
https://github.com/WebCrew My GitHub account
https://prattle.space A niceTwitter alternative - JOIN
https://sell-co.de/ Lots of Tools and Utilities for free

that helps a lot


yeah!


the next chapter is - How to prevent unregistered users from voting


@admin, your movesmile

[quote="pid:26242, uid:8261"]that helps a lot[/quote] yeah! the next chapter is - **How to prevent unregistered users from voting** @admin, your move8)
124
12
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft