astock Posted February 20, 2020 Posted February 20, 2020 @horst, thank you for your quick support! I had already activated the "by user" option. But I didn't integrate the public function in my template, because you didn't have to include it for the other options (with cookie and IP address). But these work. My attempt to call the public fuction in the template unfortunately fails.
horst Posted February 21, 2020 Posted February 21, 2020 Hi @astock, ok. I think then something is not working as expected, and I cannot help any further here, as I never used this module. Maybe we can ping @Soma, or we need the help of someone who already used this. What is the PW version you are using? 1
astock Posted February 21, 2020 Posted February 21, 2020 Hi @horst, thanks again for your help. I'am using PW version 3.0.148. Is there someone who uses Pollinio and the option with registered users?
BitPoet Posted February 22, 2020 Posted February 22, 2020 13 hours ago, astock said: Is there someone who uses Pollinio and the option with registered users? It's been a while since I did that, but I'm pretty sure it worked. Can you share the relevant code for the poll from your template?
astock Posted February 22, 2020 Posted February 22, 2020 Hi @BitPoet, Quote Can you share the relevant code for the poll from your template? I have inserted the default call for the poll: Quote $content .= $modules->Pollino->renderPoll($page); echo $content;
BitPoet Posted February 23, 2020 Posted February 23, 2020 @astock: I just checked the code. While the hasVoted method is called before renderPoll(), it doesn't get the current user. I have added a github branch with a fix if you want to give it a spin. 1 1
astock Posted February 24, 2020 Posted February 24, 2020 Hi @BitPoet, excellent! So it works fine. Thank you for your help and support! 1
astock Posted March 2, 2020 Posted March 2, 2020 I'm trying to show users who have voted and who have not yet voted. To do this, I first collect the users who have already voted (certainly not very elegant). After that I try to remove these users from the list of all users. But I get an error message. Have anyone an idea where the fault is? $datenbank = $this->wire('database'); $sql = "SELECT user_id, vote_id FROM pollino_votes WHERE ".$seitenID."=page_id"; foreach ($datenbank->query($sql) as $row) { $teilnehmer = $users->get($row['user_id']); $antwort = $pages->get($row['vote_id']); echo "<tr>"; echo "<td>".$teilnehmer->nachname.", ".$teilnehmer->vorname."</td>"; echo "<td>".$antwort->title."</td>"; echo "</tr>"; // This first part works nice! foreach ($users->find("start=0") as $nutzer) { $nu = $nutzer->nachname.$nutzer->vorname; $tn = $teilnehmer->nachname.$teilnehmer->vorname; $nu->removeItems($tn); echo $nu; // Here comes the error message: Uncaught Error: Call to a member function removeItems() on string in ... } }
BitPoet Posted March 2, 2020 Posted March 2, 2020 @astock, you don't have the lists you mention anywhere in your code. $abgestimmt = []; foreach ($datenbank->query($sql) as $row) { $teilnehmer = $users->get($row['user_id']); $antwort = $pages->get($row['vote_id']); echo "<tr>"; echo "<td>".$teilnehmer->nachname.", ".$teilnehmer->vorname."</td>"; echo "<td>".$antwort->title."</td>"; echo "</tr>"; // This first part works nice! // And here we fill the list of users who have already voted $abgestimmt[] = $teilnehmer; } $alleUser = $users->find("start=0"); // Now we remove the users who have voted and iterate // over the rest foreach($alleUser->removeItems($abgestimmt) as $nutzer) { $nu = $nutzer->nachname.$nutzer->vorname; $tn = $teilnehmer->nachname.$teilnehmer->vorname; echo $nu; } 1 1
astock Posted March 3, 2020 Posted March 3, 2020 Hi @BitPoet, that did the trick. Thanks again for your help!
Cybermano Posted March 17, 2021 Posted March 17, 2021 Hi there. First of all many thanks for the great module! We are using it only for logged users and it works like a charm. Any suggestions on how to send an email after the user vote ? (Maybe the simplyest way, if there's one...) Could it be an implementation for this module? Tons of thanks in advance.
Cybermano Posted April 1, 2021 Posted April 1, 2021 On 3/17/2021 at 4:01 PM, Cybermano said: ... Any suggestions on how to send an email after the user vote ? (Maybe the simplyest way, if there's one...) ... Hi all! In free time, I've played a bit with WireMailSmtp. Thanks to a lot of tutorials/explanation found on these forum and in the API pages, I find my way and my settings. For future readers taht maybe could need somthing similar, I've started here, here and here ( tks @ryan, @horst and many other contributors) . The power of PW always impresses... Bye! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now