function send($gm, $profile)
 {
     $gmp = new Group_message_profile();
     $gmp->group_message_id = $gm->id;
     $gmp->to_profile = $profile->id;
     $gmp->created = common_sql_now();
     $gmp->insert();
     // If it's not for the author, send email notification
     if ($gm->from_profile != $profile->id) {
         $gmp->notify();
     }
     return $gmp;
 }
 /**
  * Database schema setup
  *
  * @see Schema
  * @see ColumnDef
  *
  * @return boolean hook value
  */
 function onCheckSchema()
 {
     $schema = Schema::get();
     // For storing user-submitted flags on profiles
     $schema->ensureTable('group_privacy_settings', Group_privacy_settings::schemaDef());
     $schema->ensureTable('group_message', Group_message::schemaDef());
     $schema->ensureTable('group_message_profile', Group_message_profile::schemaDef());
     return true;
 }
Ejemplo n.º 3
0
 function distribute()
 {
     $group = User_group::getKV('id', $this->to_group);
     $member = $group->getMembers();
     while ($member->fetch()) {
         Group_message_profile::send($this, $member);
     }
 }