You are here

function ad_owners_add_form_submit in Advertisement 5

Same name and namespace in other branches
  1. 6.3 owners/ad_owners.module \ad_owners_add_form_submit()
  2. 6 owners/ad_owners.module \ad_owners_add_form_submit()
  3. 6.2 owners/ad_owners.module \ad_owners_add_form_submit()
  4. 7 owners/ad_owners.module \ad_owners_add_form_submit()

File

./ad.module, line 1447
An advertising system for Drupal powered websites.

Code

function ad_owners_add_form_submit($form_id, $form_values) {
  $owner = user_load(array(
    'name' => $form_values['username'],
  ));
  if (!ad_owners_add($form_values['aid'], $owner->uid)) {
    form_set_error('username', t('The user is already an owner of the ad.'));
  }
  else {
    drupal_set_message(t('The user %username has been added as an owner of this advertisement.', array(
      '%username' => $form_values['username'],
    )));
    drupal_goto('node/' . $form_values['aid'] . "/adowners/{$owner->uid}/permissions");
  }
}