function user_badges_action_remove_badge_by_name in User Badges 6
Same name and namespace in other branches
- 6.2 user_badges.rules.inc \user_badges_action_remove_badge_by_name()
Implements a Rules action. Removes a badge from the current user, by the textual name of the badge.
File
- ./
user_badges.rules.inc, line 259 - Provide better integration into the rules module
Code
function user_badges_action_remove_badge_by_name($account, $settings) {
if (isset($account->uid)) {
$uid = $account->uid;
}
else {
global $user;
$uid = $user->uid;
}
$badges = user_badges_get_badges('all');
foreach ($badges as $bid => $vals) {
if ($settings['badge'] == $vals->name) {
user_badges_user_remove_badge($uid, $bid, 'user');
}
}
}