3 * Table Definition for subscription_queue
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Subscription_queue extends Managed_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'subscription_queue'; // table name
18 function staticGet($k,$v=null)
19 { return Memcached_DataObject::staticGet('Subscription_queue',$k,$v); }
23 { return Memcached_DataObject::pkeyGet('Subscription_queue',$k); }
25 /* the code above is auto generated do not remove the tag below */
28 public static function schemaDef()
31 'description' => 'Holder for subscription requests awaiting moderation.',
33 'subscriber' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'),
34 'subscribed' => array('type' => 'int', 'not null' => true, 'description' => 'remote or local profile being subscribed to'),
35 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
37 'primary key' => array('subscriber', 'subscribed'),
39 'group_join_queue_profile_id_created_idx' => array('subscriber', 'created'),
40 'group_join_queue_group_id_created_idx' => array('subscribed', 'created'),
42 'foreign keys' => array(
43 'group_join_queue_subscriber_fkey' => array('profile', array('subscriber' => 'id')),
44 'group_join_queue_subscribed_fkey' => array('profile', array('subscribed' => 'id')),
49 public static function saveNew(Profile $subscriber, Profile $other)
51 $rq = new Group_join_queue();
52 $rq->subscriber = $subscriber->id;
53 $rq->subscribed = $subscribed->id;
54 $rq->created = common_sql_now();
60 * Send notifications via email etc to group administrators about
61 * this exciting new pending moderation queue item!
63 public function notify()
65 $subscriber = Profile::staticGet('id', $this->subscriber);
66 $subscribed = Profile::staticGet('id', $this->subscribed);
67 mail_notify_subscription_pending($subscribed, $subscriber);