diff options
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php index 36111ac0c..186602562 100644 --- a/classes/User.php +++ b/classes/User.php @@ -112,4 +112,18 @@ class User extends DB_DataObject function getCarrier() { return Sms_carrier::staticGet($this->carrier); } + + function subscribeTo($other) { + $sub = new Subscription(); + $sub->subscriber = $this->id; + $sub->subscribed = $other->id; + + $sub->created = DB_DataObject_Cast::dateTime(); # current time + + if (!$sub->insert()) { + return false; + } + + return $true; + } } |