Active
Project:
Search Restrict
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2011 at 08:51 UTC
Updated:
28 Mar 2012 at 03:02 UTC
the _search_restrict_advanced_form() function has a bug, with "empty" search_restrict_content_type variable
empty like:
array('page' => array(1=> 0, 2=>0, 3=>0))
the page content type will not be available in advanced_search
this case is correctly handled in _search_restrict_excluded_content_types() so it should be used like:
function _search_restrict_advanced_form($form, &$form_state) {
global $user;
if ($user->uid == 1) {
return $form;
}
foreach (_search_restrict_excluded_content_types() as $type) {
unset($form['advanced']['type']['#options'][$type]);
unset($form['advanced']['type'][$type]);
}
return $form;
}
another improvement: I would remove condition user=1, because in D7 the admin role should be used for such cases..
Comments
Comment #1
jonathan_hunt commentedPatch incorporating the code above is at https://drupal.org/node/1293472#comment-5793230