You are here

function og_unsubscribe_user_action in Organic groups 6.2

Same name and namespace in other branches
  1. 6 modules/og_actions/og_actions.module \og_unsubscribe_user_action()

A configurable action to unsubscribe a user from specific groups.

File

modules/og_actions/og_actions.module, line 297

Code

function og_unsubscribe_user_action($account, $context) {
  if (isset($context['groups'])) {
    foreach ($context['groups'] as $gid) {
      og_delete_subscription($gid, $account->uid);
    }
    watchdog('action', 'Unsubscribed user %name from groups %groups.', array(
      '%name' => $account->name,
      '%groups' => implode(',', $context['groups']),
    ));
  }
}