User login

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).

Searched words: 
drupal 7 user search permission move user search tab from search/user to admin/people/search Drupal 7 Drupal 7 move a menu item to a new path

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.