Skip to content

Instantly share code, notes, and snippets.

@chales
Created February 7, 2013 20:57
Show Gist options
  • Save chales/4734092 to your computer and use it in GitHub Desktop.
Save chales/4734092 to your computer and use it in GitHub Desktop.
Drupal 6 advanced user view. Displays user info with search options and in a sortable fashion. View is for 6.x-2.x views and requires views bulk operations for user manipulations, http://drupal.org/project/views_bulk_operations
$view = new view;
$view->name = 'admin_users';
$view->description = 'Emulates the Drupal user administration page.';
$view->tag = '';
$view->base_table = 'users';
$view->core = 0;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Default', 'default');
$handler->override_option('fields', array(
'counter' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'absolute' => 0,
'link_class' => '',
'alt' => '',
'rel' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'counter_start' => '1',
'exclude' => 0,
'id' => 'counter',
'table' => 'views',
'field' => 'counter',
'relationship' => 'none',
),
'name' => array(
'label' => 'Username',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'mail' => array(
'label' => 'E-mail',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'absolute' => 0,
'link_class' => '',
'alt' => '',
'rel' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '30',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'link_to_user' => 'mailto',
'exclude' => 0,
'id' => 'mail',
'table' => 'users',
'field' => 'mail',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'rid' => array(
'label' => 'Roles',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'ul',
'separator' => ', ',
'exclude' => 0,
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'relationship' => 'none',
),
'status' => array(
'label' => 'Active',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'yes-no',
'not' => 0,
'exclude' => 0,
'id' => 'status',
'table' => 'users',
'field' => 'status',
'relationship' => 'none',
),
'created' => array(
'label' => 'Member for',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'raw time span',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
),
'access' => array(
'label' => 'Last access',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'time ago',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'access',
'table' => 'users',
'field' => 'access',
'relationship' => 'none',
),
'edit_node' => array(
'label' => 'Operations',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'text' => '',
'exclude' => 0,
'id' => 'edit_node',
'table' => 'users',
'field' => 'edit_node',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'uid' => array(
'operator' => 'not in',
'value' => array(
0 => 0,
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'uid_op',
'identifier' => 'uid',
'label' => 'Username',
'optional' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'none',
),
'rid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'rid_op',
'identifier' => 'rid',
'label' => 'Role',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'status' => array(
'operator' => '=',
'value' => 'All',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'status',
'label' => 'Active',
'optional' => 1,
'remember' => 0,
),
'id' => 'status',
'table' => 'users',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'mail' => array(
'operator' => 'contains',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'mail_op',
'identifier' => 'mail',
'label' => 'E-mail',
'remember' => 0,
),
'case' => 0,
'id' => 'mail',
'table' => 'users',
'field' => 'mail',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'administer users',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 50);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'bulk');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'summary' => '',
'columns' => array(
'counter' => 'counter',
'name' => 'name',
'mail' => 'mail',
'rid' => 'rid',
'status' => 'status',
'created' => 'created',
'access' => 'access',
'edit_node' => 'edit_node',
),
'info' => array(
'counter' => array(
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'mail' => array(
'sortable' => 1,
'separator' => '',
),
'rid' => array(
'separator' => '',
),
'status' => array(
'sortable' => 1,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'access' => array(
'sortable' => 1,
'separator' => '',
),
'edit_node' => array(
'separator' => '',
),
),
'default' => 'created',
'execution_type' => '1',
'max_performance' => 0,
'display_type' => '0',
'hide_selector' => 0,
'preserve_selection' => 1,
'display_result' => 1,
'merge_single_action' => 1,
'operations' => array(
'og_approve_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'user_block_ip_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'user_block_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'user_user_operations_block' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'system_goto_action-813373fda2d72ba186d644297b8a1b50' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'nodewords_mass_delete_tags-9fed5062c31d06cb075d45f06617e1b3' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_delete_user_action' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'og_demote_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'og_deny_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'system_message_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_script_action' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'spam_mark_user_as_not_spam_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'spam_mark_user_as_spam_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_profile_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_user_roles_action' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_argument_selector_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'og_promote_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'system_goto_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'system_send_email_action-fa2e2dfb70204777319d97792eaf6cc1' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'system_send_email_action' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_ruleset_action_rules_subscribe_a_user_to_organic_groups_notifications' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'og_subscribe_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'user_user_operations_unblock' => array(
'selected' => 1,
'skip_confirmation' => 0,
'label' => '',
),
'views_bulk_operations_ruleset_action_rules_unsubscribe_a_user_to_organic_groups_notifications' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'og_unsubscribe_user_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
'pathauto_user_update_alias_multiple-620e193b20ba9caa374fea9ca0ad38f0' => array(
'selected' => 0,
'skip_confirmation' => 0,
'label' => '',
),
),
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'admin/user/user2');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Users Advanced',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment