function user_badges_user_remove_badge in User Badges 6.2
Same name and namespace in other branches
- 5 user_badges.module \user_badges_user_remove_badge()
- 6 user_badges.module \user_badges_user_remove_badge()
- 7.4 user_badges.module \user_badges_user_remove_badge()
- 7 user_badges.module \user_badges_user_remove_badge()
- 7.2 user_badges.module \user_badges_user_remove_badge()
- 7.3 user_badges.module \user_badges_user_remove_badge()
remove a badge from user.
Parameters
$uid User ID.:
$bid Badge ID.:
$type Whether set as part of the role, or individually assigned ('user', 'role').:
Return value
bool with query success
6 calls to user_badges_user_remove_badge()
- user_badges_action_remove_badge_by_name in ./
user_badges.rules.inc - Implements a Rules action. Removes a badge from the current user, by the textual name of the badge.
- user_badges_change_form_submit in ./
user_badges.module - Process user_badges_remove_form form submissions.
- user_badges_remove_badge_action in ./
user_badges.module - Implementsa Drupal action. Removes a badge to the current user.
- user_badges_user in ./
user_badges.module - Implements hook_user().
- user_badges_user_add_badge in ./
user_badges.module - Add a badge to user.
File
- ./
user_badges.module, line 756 - @brief User Badges module file
Code
function user_badges_user_remove_badge($uid, $bid, $type = NULL) {
// Integrate rules events.
if (module_exists('rules')) {
$arguments = array(
'user' => user_load($uid),
'badge_id' => $bid,
);
rules_invoke_event('user_badges_badge_removed', $arguments);
}
if (is_null($type)) {
return db_query('DELETE FROM {user_badges_user} WHERE uid=%d AND bid=%d', $uid, $bid);
}
else {
return db_query('DELETE FROM {user_badges_user} WHERE uid=%d AND bid=%d AND type=\'%s\'', $uid, $bid, $type);
}
}