move user search tab from search/user to admin/people/search
Agaric decided to make a contributed module to do this: http://drupal.org/project/usersearchtoadmin
See that project page. The below is mostly notes on wrong turns!
It would be nice if this just used a different permission other than a person's ability to access profiles:
<?php
/**
* Implements hook_search_access().
*/
function user_search_access() {
return user_access('access user profiles');
}
?>
USABILITY: Search field on User List (admin/people)
http://drupal.org/node/198973
Ha: Orphaned in user.module, this case of user_help():
case 'admin/people/search':
return '
' . t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username or e-mail address. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda@example.com".') . '
';
Simply making an action link to search/user is a good start (might want to further change the name of the item from "Users" to "Search users" for this context):
/**
* Implements hook_menu_local_tasks_alter().
*/
function libcat_search_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add action link to 'node/add/suggestion' on 'suggestions' page.
if ($root_path == 'admin/people') {
$item = menu_get_item('search/user');
if ($item['access']) {
$data['actions']['output'][] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
);
}
}
}
Making a tab would be misleading, but here's tabs for reference anyway.
'tabs' =>
array (
0 =>
array (
'count' => 3,
'output' =>
array (
0 =>
array (
'#theme' => 'menu_local_task',
'#link' =>
array (
'path' => 'admin/people/people',
'load_functions' => '',
'to_arg_functions' => '',
'access_callback' => 'user_access',
'access_arguments' => 'a:1:{i:0;s:16:"administer users";}',
'page_callback' => 'user_admin',
'page_arguments' => 'a:1:{i:0;s:4:"list";}',
'delivery_callback' => '',
'fit' => '7',
'number_parts' => '3',
'context' => '1',
'tab_parent' => 'admin/people',
'tab_root' => 'admin/people',
'title' => 'List',
'title_callback' => 't',
'title_arguments' => '',
'theme_callback' => '',
'theme_arguments' => 'a:0:{}',
'type' => '140',
'description' => 'Find and manage people interacting with your site.',
'position' => '',
'weight' => '-10',
'include_file' => 'modules/user/user.admin.inc',
'href' => 'admin/people',
'tab_root_href' => 'admin/people',
'tab_parent_href' => 'admin/people',
'options' =>
array (
),
'access' => true,
'localized_options' =>
array (
),
),
'#active' => true,
),
1 =>
array (
'#theme' => 'menu_local_task',
'#link' =>
array (
'path' => 'admin/people/uif',
'load_functions' => '',
'to_arg_functions' => '',
'access_callback' => 'user_access',
'access_arguments' => 'a:1:{i:0;s:12:"import users";}',
'page_callback' => 'drupal_get_form',
'page_arguments' => 'a:1:{i:0;s:15:"uif_import_form";}',
'delivery_callback' => '',
'fit' => '7',
'number_parts' => '3',
'context' => '1',
'tab_parent' => 'admin/people',
'tab_root' => 'admin/people',
'title' => 'Import',
'title_callback' => 't',
'title_arguments' => '',
'theme_callback' => '',
'theme_arguments' => 'a:0:{}',
'type' => '132',
'description' => 'Import or update users.',
'position' => '',
'weight' => '0',
'include_file' => 'sites/all/modules/contrib/uif/uif.admin.inc',
'href' => 'admin/people/uif',
'tab_root_href' => 'admin/people',
'tab_parent_href' => 'admin/people',
'options' =>
array (
),
'access' => true,
'localized_options' =>
array (
),
),
),
2 =>
array (
'#theme' => 'menu_local_task',
'#link' =>
array (
'path' => 'admin/people/permissions',
'load_functions' => '',
'to_arg_functions' => '',
'access_callback' => 'user_access',
'access_arguments' => 'a:1:{i:0;s:22:"administer permissions";}',
'page_callback' => 'drupal_get_form',
'page_arguments' => 'a:1:{i:0;s:22:"user_admin_permissions";}',
'delivery_callback' => '',
'fit' => '7',
'number_parts' => '3',
'context' => '1',
'tab_parent' => 'admin/people',
'tab_root' => 'admin/people',
'title' => 'Permissions',
'title_callback' => 't',
'title_arguments' => '',
'theme_callback' => '',
'theme_arguments' => 'a:0:{}',
'type' => '132',
'description' => 'Determine access to features by selecting permissions for roles.',
'position' => '',
'weight' => '0',
'include_file' => 'modules/user/user.admin.inc',
'href' => 'admin/people/permissions',
'tab_root_href' => 'admin/people',
'tab_parent_href' => 'admin/people',
'options' =>
array (
),
'access' => true,
'localized_options' =>
array (
),
),
),
),
),
),
)
It still shows the other tabs next to it... and that in turn seems to produce these errors:
Notice: Undefined index: node in libcat_search_preprocess_search_result() (line 26 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Notice: Trying to get property of non-object in libcat_search_preprocess_search_result() (line 28 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Notice: Undefined index: node in libcat_search_preprocess_search_result() (line 26 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Notice: Trying to get property of non-object in libcat_search_preprocess_search_result() (line 28 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Notice: Undefined index: node in libcat_search_preprocess_search_result() (line 26 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Notice: Trying to get property of non-object in libcat_search_preprocess_search_result() (line 28 of /home/ben/code/libcat/web/sites/all/modules/custom/libcat_search/libcat_search.module).
Comments
Post new comment