Posted by skinnydog on November 23, 2007 at 12:21am
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
Comments
=-=
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
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()
If my comments have helped you, please pay it forward!
Use issue queues to discuss module issues - this will help your questions assist others (including yourself!) in future.
http://twitter.com/grobot ● www.giantrobot.co.nz
<?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?
This also works for D6
Thanks for the tip!
Cheers,
You can also try this
You can also try this :)
http://drupal.org/project/coresearches
ClipGlobe - World Travel
****Me and Drupal :)****
Clickbank IPN - Sell online or create a membership site with the largest affiliate network!
Review Critical - One of my sites
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
KahThong.com - My portfolio. PHP Web Developer from Malaysia.
Oh really? and wich class or
Oh really? and wich class or id would you use?
www.nosfuimos.cl
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:)
I ♥ Drupal.
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
check Tab Tamer module
check Tab Tamer module
www.nosfuimos.cl
How to Remove the 'search/user' path
Using the example code at http://drupal.org/node/483324 I made a custom module to remove the Users tab from search pages. The tabs did disappear; however users are still able to access the search/user path and search for accounts.
Here is the code I used in the custom module. Did I miss something?
<?php
// $Id: custom_mod.module
/**
* @file
* Custom functions and overrides.
*/
/**
* Implementation of hook_menu_alter().
* Remember to clear the menu cache after adding/editing this function.
*/
function custom_mod_menu_alter(&$items) {
// Removing certain local navigation tabs that are either undesired or need to be custom relocated.
// Set these tabs to MENU_CALLBACK, so they still register the path, but just don't show the tab:
$items['node/%node/track']['type'] = MENU_CALLBACK;
$items['user/%user/track']['type'] = MENU_CALLBACK;
$items['search/user']['type'] = MENU_CALLBACK;
// Fully unset these tabs and their paths, don't want them at all. This breaks the path as well:
unset($items['search/user']['type']);
}
Overriding 'access callback'
In hook_menu_alter override 'access callback'.
This way it is possible to both hide the user search tab and block access to search/user.
For example, to restrict access to search/user only to users with 'administer users' permission.
The user/autocomplete path is handled in the same way.
<?php
function mymodule_menu_alter(&$items) {
if (isset($items['search/user/%menu_tail'])) {
$menu_item =& $items['search/user/%menu_tail'];
$menu_item['access callback'] = 'user_access';
$menu_item['access arguments'] = array('administer users');
}
if (isset($items['user/autocomplete'])) {
$menu_item =& $items['user/autocomplete'];
$menu_item['access callback'] = 'user_access';
$menu_item['access arguments'] = array('administer users');
}
}
?>
Tested in Drupal 6.16 with core search.
(It is also possible to add a specific permission, e.g. 'search users', and use that as the access argument).
-- geneticdrift
@geneticdrift - thanks -
@geneticdrift - thanks - works excellent ...
Thank you , it worked excellent
Thank you , it worked excellent also for me!
In drupal 7 you can disable
In drupal 7 you can disable the user search module at admin/config/search/settings