You are here

function _shoutbox_group_alter_form in Shoutbox 7.2

Same name and namespace in other branches
  1. 6.2 shoutbox_group/shoutbox_group.module \_shoutbox_group_alter_form()
  2. 7 shoutbox_group/shoutbox_group.module \_shoutbox_group_alter_form()

Alter the shoutbox add form Add the group ID to the shout form (if one)

Parameters

$form: The shoutbox add form

1 call to _shoutbox_group_alter_form()
shoutbox_group_shoutbox in shoutbox_group/shoutbox_group.module
Implementation of hook_shoutbox()

File

shoutbox_group/shoutbox_group.module, line 84

Code

function _shoutbox_group_alter_form(&$form) {

  // Check that shoutbox is being used with a group
  if ($group = shoutbox_group_get_group()) {

    // If user is not a group member, or lacks permissions, remove the ability to shout
    if (!shoutbox_group_group_access('post', $group)) {
      $form = array(
        '#type' => 'item',
        '#value' => t('Only group members may post here.'),
      );
    }
    else {

      // Append the current group ID to form
      $form['group_id'] = array(
        '#type' => 'value',
        '#value' => $group['gid'],
      );
    }
  }
}