You are here

function flag_clear_unflag in Flag clear 7

1 string reference to 'flag_clear_unflag'
flag_clear_menu in ./flag_clear.module

File

./flag_clear.module, line 147
Code for the Flag clear module.

Code

function flag_clear_unflag($flag = NULL, $entity = NULL, $uid = NULL) {
  $user = user_load($uid);
  $flag = flag_get_flag($flag);
  $flag
    ->flag('unflag', $entity, $user, TRUE);
  drupal_set_message(t('Unflagged "@flag" for entity #@entity by @user', array(
    '@flag' => $flag->title,
    '@entity' => $entity,
    '@user' => $user->name,
  )));

  // Redirect to the entity that has been unflagged.
  $destination = isset($_REQUEST['destination']) ? $_REQUEST['destination'] : 'node/' . $entity;
  drupal_goto($destination);
}