No contents types are showing up, no matter what permissions I assign.

Drupal 6.14

Comments

fizk’s picture

Here's the problem

if (!empty($selected) && in_array($role_id, $user->roles))

$user->roles is the name of the role, but $role_id is the integer value of the role.

fizk’s picture

Here's a solution:

search_restrict.module: Line 139

Change
if (!empty($selected) && in_array($role_id, $user->roles)) {

to

if (!empty($selected) && isset($user->roles[$role_id])) {

jgreep’s picture

This definitely helps, but when selecting the roles, the instructions say "If all checkboxes are unselected then everyone can search."

I find that I still need to select at least authenticated user for anything to show up.

oda’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new889 bytes

You should also check if all (or none) roles were checked. It could be something like that in rewrite_sql hook.

I suggest the attached patch.

Thanks!

oda’s picture

Status: Reviewed & tested by the community » Needs review

oops, wrong status :P

fizk’s picture

Priority: Normal » Critical
leksat’s picture

StatusFileSize
new835 bytes

Here is my patch for solving this problem.

leksat’s picture

StatusFileSize
new817 bytes

Example. I have 3 roles on my site, and I'm configured some content type (for example, page) 'anonymous' => off, 'authenticated' => on, 'admin' => on. Then I'm add new role 'stuff'. And stuff will allowed to search page.

Here another patch for fix that bug.

neochief’s picture

Subscribe

Leeteq’s picture

How come an issue marked "Critical" with this kind of showstopper-like title and having a proposed fix, is not even pushed to the -dev version in over a year?

Leeteq’s picture

Title: Not working at all » Search Restrict module not working at all
Version: 6.x-1.3 » 7.x-1.x-dev

btw, is this relevant for the 7.x branch too, or only 6.x?