1.20.x user.install user_update_1009()

Create the default view for user administration.

Related topics

File

modules/user/user.install, line 489
Install, update and uninstall functions for the user module.

Code

function user_update_1009() {
  $view_config = array(
    'name' => 'user_admin',
    'description' => 'Manage user accounts, roles, and permissions.',
    'module' => 'user',
    'storage' => 4,
    'tag' => 'default',
    'disabled' => FALSE,
    'base_table' => 'users',
    'human_name' => 'Administer user accounts',
    'core' => '1.0-dev',
    'display' => array(
      'default' => array(
        'display_title' => 'Master',
        'display_plugin' => 'default',
        'display_options' => array(
          'query' => array(
            'type' => 'views_query',
            'options' => array(),
          ),
          'access' => array(
            'type' => 'perm',
            'perm' => 'administer users',
          ),
          'cache' => array(
            'type' => 'none',
          ),
          'exposed_form' => array(
            'type' => 'basic',
            'options' => array(
              'submit_button' => 'Filter',
              'reset_button' => 0,
              'reset_button_label' => 'Reset',
              'exposed_sorts_label' => 'Sort by',
              'expose_sort_order' => 1,
              'sort_asc_label' => 'Asc',
              'sort_desc_label' => 'Desc',
              'autosubmit' => 0,
              'autosubmit_hide' => 1,
            ),
          ),
          'pager' => array(
            'type' => 'full',
            'options' => array(
              'items_per_page' => '50',
              'offset' => '0',
              'id' => '0',
              'total_pages' => '',
              'quantity' => '9',
              'tags' => array(
                'first' => '« first',
                'previous' => '‹ previous',
                'next' => 'next ›',
                'last' => 'last »',
              ),
              'expose' => array(
                'items_per_page' => 0,
                'items_per_page_label' => 'Items per page',
                'items_per_page_options' => '5, 10, 20, 40, 60',
                'items_per_page_options_all' => 0,
                'items_per_page_options_all_label' => '- All -',
                'offset' => 0,
                'offset_label' => 'Offset',
              ),
            ),
          ),
          'style_plugin' => 'table',
          'row_plugin' => 'fields',
          'fields' => array(
            'bulk_form' => array(
              'id' => 'bulk_form',
              'table' => 'users',
              'field' => 'bulk_form',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Operations',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => '',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'include_exclude' => 'exclude',
              'selected_actions' => array(),
            ),
            'name' => array(
              'id' => 'name',
              'table' => 'users',
              'field' => 'name',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Username',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => '',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'link_to_user' => 1,
              'overwrite_anonymous' => 0,
              'anonymous_text' => '',
              'format_username' => 1,
            ),
            'status' => array(
              'id' => 'status',
              'table' => 'users',
              'field' => 'status',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Status',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => 'priority-low',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'type' => 'active-blocked',
              'type_custom_true' => '',
              'type_custom_false' => '',
              'not' => 0,
            ),
            'role' => array(
              'id' => 'role',
              'table' => 'users_roles',
              'field' => 'role',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Roles',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => 'priority-medium',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'type' => 'ul',
              'separator' => ', ',
            ),
            'created' => array(
              'id' => 'created',
              'table' => 'users',
              'field' => 'created',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Member for',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => 'priority-low',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'date_format' => 'raw time ago',
              'custom_date_format' => '',
              'timezone' => '',
            ),
            'access' => array(
              'id' => 'access',
              'table' => 'users',
              'field' => 'access',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Last access',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => 'priority-low',
              'element_label_colon' => 1,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'date_format' => 'raw time ago',
              'custom_date_format' => '',
              'timezone' => '',
            ),
            'edit_node' => array(
              'id' => 'edit_node',
              'table' => 'users',
              'field' => 'edit_node',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Edit',
              'exclude' => 1,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => '',
              'element_label_colon' => 0,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'text' => '',
            ),
            'cancel_node' => array(
              'id' => 'cancel_node',
              'table' => 'users',
              'field' => 'cancel_node',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Cancel',
              'exclude' => 1,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => '',
              'element_label_colon' => 0,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'text' => '',
            ),
            'dropbutton' => array(
              'id' => 'dropbutton',
              'table' => 'views',
              'field' => 'dropbutton',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => 'Operations',
              'exclude' => 0,
              'element_type' => '',
              'element_class' => '',
              'element_label_type' => '',
              'element_label_class' => '',
              'element_label_colon' => 0,
              'element_wrapper_type' => '',
              'element_wrapper_class' => '',
              'element_default_classes' => 0,
              'empty' => '',
              'hide_empty' => 0,
              'empty_zero' => 0,
              'hide_alter_empty' => 1,
              'fields' => array(
                'edit_node' => 'edit_node',
                'cancel_node' => 'cancel_node',
                'bulk_form' => 0,
                'name' => 0,
                'status' => 0,
                'role' => 0,
                'created' => 0,
                'access' => 0,
              ),
              'destination' => 1,
            ),
          ),
          'filters' => array(
            'uid_raw' => array(
              'id' => 'uid_raw',
              'table' => 'users',
              'field' => 'uid_raw',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'operator' => '!=',
              'value' => array(
                'min' => '',
                'max' => '',
                'value' => '0',
              ),
              'group' => 1,
              'exposed' => FALSE,
              'expose' => array(
                'operator_id' => FALSE,
                'label' => '',
                'description' => '',
                'use_operator' => FALSE,
                'operator' => '',
                'identifier' => '',
                'required' => FALSE,
                'remember' => FALSE,
                'multiple' => FALSE,
                'remember_roles' => array(
                  'authenticated' => 'authenticated',
                ),
              ),
              'is_grouped' => FALSE,
              'group_info' => array(
                'label' => '',
                'description' => '',
                'identifier' => '',
                'optional' => TRUE,
                'widget' => 'select',
                'multiple' => FALSE,
                'remember' => 0,
                'default_group' => 'All',
                'default_group_multiple' => array(),
                'group_items' => array(),
              ),
            ),
            'status' => array(
              'id' => 'status',
              'table' => 'users',
              'field' => 'status',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'operator' => '=',
              'value' => 'All',
              'group' => 1,
              'exposed' => TRUE,
              'expose' => array(
                'operator_id' => '',
                'label' => 'Status',
                'description' => '',
                'use_operator' => FALSE,
                'operator' => 'status_op',
                'identifier' => 'status',
                'required' => 0,
                'remember' => 0,
                'multiple' => FALSE,
                'remember_roles' => array(
                  'authenticated' => 'authenticated',
                  'anonymous' => 0,
                  'administrator' => 0,
                ),
              ),
              'is_grouped' => FALSE,
              'group_info' => array(
                'label' => '',
                'description' => '',
                'identifier' => '',
                'optional' => TRUE,
                'widget' => 'select',
                'multiple' => FALSE,
                'remember' => 0,
                'default_group' => 'All',
                'default_group_multiple' => array(),
                'group_items' => array(),
              ),
            ),
            'role' => array(
              'id' => 'role',
              'table' => 'users_roles',
              'field' => 'role',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'operator' => 'or',
              'value' => array(),
              'group' => 1,
              'exposed' => TRUE,
              'expose' => array(
                'operator_id' => 'role_op',
                'label' => 'Role',
                'description' => '',
                'use_operator' => 0,
                'operator' => 'role_op',
                'identifier' => 'role',
                'required' => 0,
                'remember' => 0,
                'multiple' => 0,
                'remember_roles' => array(
                  'authenticated' => 'authenticated',
                  'anonymous' => 0,
                  'administrator' => 0,
                ),
                'reduce' => 0,
              ),
              'is_grouped' => FALSE,
              'group_info' => array(
                'label' => '',
                'description' => '',
                'identifier' => '',
                'optional' => TRUE,
                'widget' => 'select',
                'multiple' => FALSE,
                'remember' => 0,
                'default_group' => 'All',
                'default_group_multiple' => array(),
                'group_items' => array(),
              ),
              'reduce_duplicates' => 0,
            ),
            'name' => array(
              'id' => 'name',
              'table' => 'users',
              'field' => 'name',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'operator' => 'contains',
              'value' => '',
              'group' => '1',
              'exposed' => TRUE,
              'expose' => array(
                'operator_id' => 'name_op',
                'label' => 'Name',
                'description' => '',
                'use_operator' => 0,
                'operator' => 'name_op',
                'identifier' => 'name',
                'required' => 0,
                'remember' => 0,
                'multiple' => FALSE,
                'remember_roles' => array(
                  'authenticated' => 'authenticated',
                  'anonymous' => 0,
                  'administrator' => 0,
                ),
              ),
              'is_grouped' => FALSE,
              'group_info' => array(
                'label' => '',
                'description' => '',
                'identifier' => '',
                'optional' => TRUE,
                'widget' => 'select',
                'multiple' => FALSE,
                'remember' => 0,
                'default_group' => 'All',
                'default_group_multiple' => array(),
                'group_items' => array(),
              ),
            ),
          ),
          'sorts' => array(
            'created' => array(
              'id' => 'created',
              'table' => 'users',
              'field' => 'created',
              'order' => 'DESC',
            ),
          ),
          'style_options' => array(
            'grouping' => array(),
            'row_class' => '',
            'default_row_class' => 0,
            'row_class_special' => 1,
            'override' => 1,
            'sticky' => 0,
            'caption' => '',
            'summary' => '',
            'columns' => array(
              'bulk_form' => 'bulk_form',
              'name' => 'name',
              'status' => 'status',
              'role' => 'role',
              'created' => 'created',
              'access' => 'access',
              'edit_node' => 'edit_node',
              'cancel_node' => 'cancel_node',
              'dropbutton' => 'dropbutton',
            ),
            'info' => array(
              'bulk_form' => array(
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'name' => array(
                'sortable' => 1,
                'default_sort_order' => 'asc',
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'status' => array(
                'sortable' => 1,
                'default_sort_order' => 'asc',
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'role' => array(
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'created' => array(
                'sortable' => 1,
                'default_sort_order' => 'desc',
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'access' => array(
                'sortable' => 1,
                'default_sort_order' => 'asc',
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'edit_node' => array(
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'cancel_node' => array(
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
              'dropbutton' => array(
                'align' => '',
                'separator' => '',
                'empty_column' => 0,
              ),
            ),
            'default' => 'created',
            'empty_table' => 1,
          ),
          'header' => array(),
          'title' => 'People',
          'empty' => array(
            'area_text_custom' => array(
              'id' => 'area_text_custom',
              'table' => 'views',
              'field' => 'area_text_custom',
              'relationship' => 'none',
              'group_type' => 'group',
              'ui_name' => '',
              'label' => '',
              'empty' => TRUE,
              'content' => 'No accounts found.',
              'tokenize' => 0,
            ),
          ),
          'filter_groups' => array(
            'operator' => 'AND',
            'groups' => array(
              '1' => 'AND',
            ),
          ),
        ),
      ),
      'page' => array(
        'display_title' => 'Page',
        'display_plugin' => 'page',
        'display_options' => array(
          'query' => array(
            'type' => 'views_query',
            'options' => array(),
          ),
          'path' => 'admin/people/list',
          'menu' => array(
            'type' => 'default tab',
            'title' => 'Manage user accounts',
            'description' => '',
            'name' => 'management',
            'weight' => '0',
            'context' => 0,
            'context_only_inline' => 0,
          ),
          'tab_options' => array(
            'type' => 'normal',
            'title' => 'People',
            'description' => 'Manage user accounts, roles, and permissions.',
            'name' => 'management',
            'weight' => '-6',
          ),
        ),
      ),
    ),
  );

  $config = config('views.view.user_admin');
  if ($config->isNew()) {
    $config->setData($view_config);
    $config->save();
  }
}