You are here

function og_deny in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og.module \og_deny()
  2. 5 og.module \og_deny()
  3. 5.2 og.module \og_deny()
  4. 5.3 og.module \og_deny()
  5. 5.7 og.module \og_deny()
  6. 6 og.module \og_deny()

Deny a user's membership request to a group.

The user's request has been denied. The blocked membership in the group is deleted.

Parameters

$node: Node object of the group.

$account: User object of the user to be approved.

$token: Security token to prevent CSRF attacks.

1 string reference to 'og_deny'
og_menu in ./og.module
Implementation of hook_menu().

File

./og.module, line 955
Code for the Organic Groups module.

Code

function og_deny($node, $account, $token) {
  if (!og_check_token($token, $node->nid)) {
    drupal_set_message(t('Bad token. You seem to have followed an invalid link.'), 'error');
    drupal_access_denied();
    return;
  }
  og_delete_subscription($node->nid, $account->uid);
  drupal_set_message(t('Membership request denied.'));
  $variables = array(
    '@title' => $node->title,
    '!group_url' => url("node/{$node->nid}", array(
      'absolute' => TRUE,
    )),
  );
  $message = array(
    'subject' => _og_mail_text('og_deny_user_subject', $variables),
    'body' => _og_mail_text('og_deny_user_body', $variables),
  );
  module_invoke_all('og', 'user deny', $node->nid, $account->uid, $message);
  drupal_goto("node/{$node->nid}");
}