After configuring search and unchecking "user 1" restriction, user 1 no longer sees the keyword text input on the search form.

The only thing on the form is a "advanced search" fieldset and "advanced search" button:
busted search

Here are my search configs:

content_node_search_config: Array
(
    [forms] => Array
        (
            [toggle_forms] => 1
            [move_keyword_search] => 0
            [advanced_populate] => 0
            [remove_containing_wrapper] => remove
            [advanced_expand] => default
        )

    [fields] => Array
        (
            [containing_any] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [containing_phrase] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [containing_none] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [types] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                    [filter] => Array
                        (
                            [blog_post_update] => 0
                            [campaign] => 0
                            [event] => 0
                            [landing_page] => 0
                            [listing_page] => 0
                            [member_story] => 0
                            [page] => 0
                            [resource] => 0
                        )

                    [groupings] => Array
                        (
                        )

                )

            [category] => Array
                (
                    [remove] => 0
                    [roles] => Array
                        (
                            [0] => 0
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [language] => Array
                (
                    [remove] => 0
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

        )

    [results] => Array
        (
            [limit] => 10
        )

    [restrictions] => Array
        (
            [admin_bypass] => 0
        )

)

search_active_modules: Array
(
    [node] => node
    [user] => 0
)

search_config: Array
(
    [forms] => Array
        (
            [toggle_forms] => 1
            [move_keyword_search] => 0
            [advanced_populate] => 0
            [remove_containing_wrapper] => remove
            [advanced_expand] => default
        )

    [fields] => Array
        (
            [containing_any] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [containing_phrase] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [containing_none] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [types] => Array
                (
                    [remove] => 1
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                    [filter] => Array
                        (
                            [blog_post_update] => 0
                            [campaign] => 0
                            [event] => 0
                            [landing_page] => 0
                            [listing_page] => 0
                            [member_story] => 0
                            [page] => 0
                            [resource] => 0
                        )

                    [groupings] => Array
                        (
                        )

                )

            [category] => Array
                (
                    [remove] => 0
                    [roles] => Array
                        (
                            [0] => 0
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

            [language] => Array
                (
                    [remove] => 0
                    [roles] => Array
                        (
                            [1] => 0
                            [2] => 0
                            [3] => 0
                            [4] => 0
                        )

                )

        )

    [results] => Array
        (
            [limit] => 10
        )

    [restrictions] => Array
        (
            [admin_bypass] => 0
        )

)

search_cron_limit: "100"
search_default_module: "node"

Comments

alan d.’s picture

Does the admin user actually have any roles? Since I could not use user_access('permission') with admin user 1 (they always have permission), I moved to a manual role check.

aaronbauman’s picture

StatusFileSize
new9.54 KB

user 1 has "administrator" role with the following permissions:
* use search
* use advanced search
* administer search

additionally, "authenticated user" has the permission "use search"

When i toggle the checkbox for "Only show one form at a time" to off, the basic search form shows up, but the advanced form is still empty.
I think it's because i have opted to hide all the advanced search options:
(edit: see attached image. drupal doesn't like my img tag for some reason)

Would it make more sense to get rid of the "admin bypass" checkbox, and expose that as a permission instead?

alan d.’s picture

OK to paraphrase, the issue is that you only want to show the basic form with the search restrictions? Or are you trying to allow the admin user 1 to access this?

aaronbauman’s picture

Right - basically my goal is to show the simplest of search forms: one text input field and one submit button and nothing else.
(Think Google 10 years ago)

alan d.’s picture

Category: bug » feature
Status: Active » Needs review
StatusFileSize
new2.07 KB

Seems strange, but this is a feature request as well user 1 bypasses all permissions by design and that control was never build in..

Anyways, easy fix is to force the form to disappear for all users unconditionally. Easy to implement and understand without having to know the inner workings of Drupal permission system. :)

Untested patch attached.

alan d.’s picture

StatusFileSize
new27.33 KB

A picture says a thousand words:

aaronbauman’s picture

OK, seems like a good approach.
Your patch referred to a non-existent variable though.
Here's a reroll that grabs the appropriate setting.

alan d.’s picture

Title: Missing keyword text input field for user 1 » Option to remove the advanced form unconditionally.
Status: Needs review » Fixed

Pushed (a few years latter...)

Cheers
Alan

  • Alan D. committed db3bbd4 on 7.x-1.x
    Issue #1621322 by aaronbauman, Alan D.: Option to remove the advanced...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.