$user = $this->scoped->getUser();
if (Event::handle('StartEmailSaveForm', array($this, $this->scoped))) {
- $emailnotifysub = $this->boolean('emailnotifysub');
- $emailnotifymsg = $this->boolean('emailnotifymsg');
- $emailnotifynudge = $this->boolean('emailnotifynudge');
- $emailnotifyattn = $this->boolean('emailnotifyattn');
- $emailmicroid = $this->boolean('emailmicroid');
- $emailpost = $this->boolean('emailpost');
+ $emailnotifysub = $this->booleanintstring('emailnotifysub');
+ $emailnotifymsg = $this->booleanintstring('emailnotifymsg');
+ $emailnotifynudge = $this->booleanintstring('emailnotifynudge');
+ $emailnotifyattn = $this->booleanintstring('emailnotifyattn');
+ $emailmicroid = $this->booleanintstring('emailmicroid');
+ $emailpost = $this->booleanintstring('emailpost');
$user->query('BEGIN');
}
}
+ /**
+ * This is a cheap hack to avoid a bug in DB_DataObject
+ * where '' is non-type-aware compared to 0, which means it
+ * will always be true for values like false and 0 too...
+ *
+ * Upstream bug is::
+ * https://pear.php.net/bugs/bug.php?id=20291
+ */
+ function booleanintstring($key, $def)
+ {
+ return $this->boolean($key, $def) ? '1' : '0';
+ }
+
/**
* Integer value of an argument
*