You are here

function subuser_enable in Subuser 7.2

Same name and namespace in other branches
  1. 8 subuser.install \subuser_enable()

Implementation of hook_enable().

File

./subuser.install, line 12
Provides installation functions.

Code

function subuser_enable() {

  // Check if our field is not already created.
  if (!field_info_field('field_subuser_limit')) {
    $field = array(
      'field_name' => 'field_subuser_limit',
      'type' => 'text',
    );
    field_create_field($field);

    // Create the instance on the bundle.
    $instance = array(
      'field_name' => 'field_subuser_limit',
      'entity_type' => 'user',
      'label' => 'Subuser Limit',
      'bundle' => 'user',
      'settings' => array(
        // Here you inform either or not you want this field showing up on the registration form.
        'user_register_form' => 1,
      ),
      'widget' => array(
        'type' => 'textfield',
      ),
    );
    field_create_instance($instance);
  }
}