Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By skinnydog on
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
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
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
My Drupal 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
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.
Removed the tabs, but not the url to user search
I just built a little helper module using the following code as suggested above.
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
From here: http://drupal.org/node/483324
check Tab Tamer module
check Tab Tamer module
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?
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.
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 - thanks -
@geneticdrift - thanks - works excellent ...
Thank you , it worked excellent
Thank you , it worked excellent also for me!
Nice solution, but I cleaned
Nice solution, but I cleaned it up like so:
In drupal 7 you can disable
In drupal 7 you can disable the user search module at admin/config/search/settings
Here the code works exactly to me