Manage subscriptions

- make use of the SubscriberSegment::status column to keep track of unsubscriptions
- unsubscribed segments now appear grayed out in the Subscribers listing
- added unsubscribed_at after segment names when editing a subscriber
- added date() method for Twig (uses WP's date format / date_offset)
- fixed typo in Form iframe export
- fixed unit test for Newsletters
- updated selection component (JSX) to allow more customization
This commit is contained in:
Jonathan Labreuille
2016-02-22 11:35:34 +01:00
parent acf300160d
commit 07d533a810
19 changed files with 313 additions and 138 deletions

View File

@ -291,7 +291,7 @@ class Subscriber extends Model {
}
}
if($segment_ids !== false) {
$subscriber->addToSegments($segment_ids);
SubscriberSegment::setSubscriptions($subscriber, $segment_ids);
}
}
return $subscriber;
@ -314,6 +314,17 @@ class Subscriber extends Model {
return $this;
}
function withSegments() {
$this->segments = $this->segments()->findArray();
return $this;
}
function withSubscriptions() {
$this->subscriptions = SubscriberSegment::where('subscriber_id', $this->id())
->findArray();
return $this;
}
function getCustomField($custom_field_id, $default = null) {
$custom_field = SubscriberCustomField::select('value')
->where('custom_field_id', $custom_field_id)