Jump to content

Pollino (Simple Polls for ProcessWire)


Soma

Recommended Posts

@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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 ...
  }
}

 

Link to comment
Share on other sites

@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;
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

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.

 

Link to comment
Share on other sites

  • 2 weeks later...
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!

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...