How to remove "Users" tab from search form.
skinnydog - November 23, 2007 - 00:21
How do I remove the "users" search tab displayed on the search results page. I do not want people to search users.
-scott
How do I remove the "users" search tab displayed on the search results page. I do not want people to search users.
-scott
=-=
even if you remove the tab someone can point to yoursite.com/search/user
I believe you will have to create a custom search.tpl.php, information is available in the handbooks -> theme development section
Try this...
1. See this link here for how to strip unwanted tabs
2. Use Taxonomy Access to prevent users from pointing to yoursite.com/search/user
Good luck!
www.keelingdesign.com
thanks
thanks that worked great.
D5: don't grant "access user profiles"
Note that this tab only appears if you have "access user profiles" permission. You may only be seeing this tab because you're logged in as an administrator, or because the current role has been granted that permission.
This UI is added by user.module using hook_search()
<?phpfunction
<?php
function _phptemplate_variables($hook, $vars = array()) {
if($hook == 'page') {
yourthemename_removetab('address book', $vars);
// add additional lines here to remove other tabs
}
return $vars;
}
function yourthemename_removetab($label, &$vars) {
$tabs = explode("\n", $vars['tabs']);
$vars['tabs'] = '';
foreach($tabs as $tab) {
if(strpos($tab, '>' . $label . '<') === FALSE) {
$vars['tabs'] .= $tab . "\n";
}
}
}
?>
How to use it to remove the users tab from search? I tried copying and chaning the yourthemename to my theme name and replaced "address book" with "users" but it didn't worked? Did I missed something?
You can also try this
You can also try this :)
http://drupal.org/project/coresearches
ClipGlobe - World Travel
great
solved my issue.
sharma chelluri
You can 'hide' the search
You can 'hide' the search users tab using only CSS.
display: none;-----
http://kahthong.com - A blog, portfolio & personal site
My blog is proudly powered by Drupal
Oh really? and wich class or
Oh really? and wich class or id would you use?
Even tho you remove user
Even tho you remove user tab, the actual page would be accessible by typing "search/user"
So if you really want to remove user search from your website, you need to disable the "user_search" function in your "user" module.
In order to do this, open user.module file and find function user_search($op = 'search', $keys = NULL) and either remove or disable it.
In this case, search will not find user's search hook and will not add any tab nor any search result for users.
After every update you must
After every update you must do it again. Better is some nice template.php solution:)
Fixing this at the module level
I got results in Drupal 6 using hook_menu_alter(). This removes not only the tab but the Drupal path to user search, which is what I really needed. If this is bad, I'm sure someone will point out why, but I feel that this issue is best solved at the module/menu level rather than the theme level.
function mymodule_menu_alter(&$items) {unset($items['search/user/%menu_tail']);
}
Removed the tabs, but not the url to user search
I just built a little helper module using the following code as suggested above.
function disable_user_search_menu_alter(&$items) {unset($items['search/user/%menu_tail']);
unset($items['search/profile/%menu_tail']);
}
While it did remove the tabs from the search page, it did not remove the ability to search users or profiles. For example, I can still go to '/search/user/deanna' and return results with a list of users named 'deanna'.
Any ideas?
Thanks,
Nancy
Maybe you can use something
Maybe you can use something like
unset($items['search/user/%user/example']);From here: http://drupal.org/node/483324