You are here

function hook_og in Organic groups 6.2

Act on group subscription actions.

This hook allows modules to react when operations are performed on group subscriptions.

Parameters

$op: What kind of action is being performed. Possible values (in alphabetical order):

  • admin new: A new user is added as an admin to a group.
  • admin remove: A user's admin access to a group is removed.
  • user approve: A user has been approved for membership to a group.
  • user broadcast: Send notifications to group members.
  • user delete: A user deletes their subscription to a group.
  • user deny: A user is denied membership to a group.
  • user insert: New user joins a group.
  • user request: A user requests membership to a group.
  • user update: A user changes their subscription to a group.

$gid: The group Node ID.

$uid: The User ID affected by the message. For 'user request', array of uids for group administrators.

$args: A set of parameters that defines extended arguments. Varies by operation. user create, user update:

  • is_active: 1 to create an active subscription, 0 to create a subscription request.
  • is_admin: 1 to create a group administrator subscription, 0 to create a typical member subscription.

admin new, admin remove, user broadcast, user deny, user request:

  • subject: Subject/Title of a notification message.
  • body: Text of a notification message.

user broadcast:

  • from: The user account sending the message.
3 functions implement hook_og()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

og_notifications_og in modules/og_notifications/og_notifications.module
Implementation of hook_og().
og_og in ./og.module
Implementation of hook_og().
og_views_data_og in modules/og_views/og_views.views.inc
9 invocations of hook_og()
og_approve in ./og.module
Activate a user's membership in a group.
og_broadcast_form_submit in ./og.pages.inc
og_create_admin_confirm_submit in ./og.pages.inc
Confirm og create admin form
og_delete_subscription in ./og.module
Delete a user's membership in a specific group.
og_deny in ./og.module
Deny a user's membership request to a group.

... See full list

File

./og.api.php, line 50
Hooks provided by the Organic Groups module.

Code

function hook_og($op, $gid, $uid, $args) {
  switch ($op) {
    case 'user insert':
      drupal_set_message('User !uid added to group !gid.', array(
        '!uid' => $uid,
        '!gid' => $gid,
      ));
      break;
    case 'user delete':
      drupal_set_message('User !uid removed from group !gid.', array(
        '!uid' => $uid,
        '!gid' => $gid,
      ));
      break;
  }
}