You are here

function user_badges_delete_badge in User Badges 7.2

Same name and namespace in other branches
  1. 7 user_badges.api.php \user_badges_delete_badge()
  2. 7.3 user_badges.api.php \user_badges_delete_badge()

Deletes a user_badge from all the tables. It is the caller's responsibilty to let the user know this has been done. The caller must have 'manage badges' permission.

Parameters

$bid: The badge ID.

File

./user_badges.api.php, line 39
Document API.

Code

function user_badges_delete_badge($bid) {
  if (user_access('manage badges')) {
    db_delete('user_badges_badges')
      ->condition('bid', $bid)
      ->execute();
    db_delete('user_badges_user')
      ->condition('bid', $bid)
      ->execute();
    db_delete('user_badges_roles')
      ->condition('bid', $bid)
      ->execute();
  }
}