You are here

function ad_owner_remove_validate in Advertisement 5

Don't allow the removal of the primary owner of the advertisement.

File

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

Code

function ad_owner_remove_validate($form_id, $form_values) {
  $node = node_load($form_values['aid']);
  if ($node->uid == $form_values['uid']) {
    $owner = user_load(array(
      'uid' => $form_values['uid'],
    ));
    drupal_set_message(t('%name is the primary owner of this advertisement.  You cannot remove the primary owner.', array(
      '%name' => $owner->name,
    )), 'error');
    drupal_goto('node/' . $form_values['aid'] . '/adowners');
  }
}