diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-20 16:16:20 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-20 16:16:20 -0400 |
commit | d294c91d82804e8e8b83abaaa6c831561f5872bc (patch) | |
tree | 4e3d4108cf5ff9c3fd9a627926e961478af9df44 /classes/User.php | |
parent | 48ac5b9e85f48b2adfb34209a26d1119fdeaf172 (diff) |
add autosubscribe
darcs-hash:20080720201620-84dde-f782e01bdf7f267b3b02e20e851aa7b643ed8590.gz
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; + } } |