You are here

function shoutbox_domain_shoutbox in Shoutbox 7

Same name and namespace in other branches
  1. 6.2 shoutbox_domain/shoutbox_domain.module \shoutbox_domain_shoutbox()
  2. 7.2 shoutbox_domain/shoutbox_domain.module \shoutbox_domain_shoutbox()

Implements hook_shoutbox().

File

shoutbox_domain/shoutbox_domain.module, line 31

Code

function shoutbox_domain_shoutbox($op, &$shout, &$a1 = NULL, $form_state = NULL) {
  if (module_exists('domain')) {
    $_domain = domain_get_domain();
    switch ($op) {
      case 'insert':
        if (isset($_domain['domain_id'])) {
          $record = new stdClass();
          $record->shout_id = $shout->shout_id;
          $record->domain_id = $_domain['domain_id'];
          drupal_write_record('shoutbox_domain', $record);
        }
        break;
      case 'delete':
        db_delete('shoutbox_domain')
          ->condition('shout_id', $shout->shout_id)
          ->execute();
        break;
    }
  }
}