I was trying admin_views module included in admin_menu 6.x-3.x. It working pretty good with views with one display. But, if you add another display with the same path (to provide grained access perms to admin ui) some tabs cannot be accessed any more.

Steps to replicate:

Install Admin Views.
Add another System Display to the view: admin_user_user
Save the view and go to admin/user/user

You will see this something like this:

    * Warning: array_fill() [<a href='function.array-fill'>function.array-fill</a>]: Number of elements must be positive in db_placeholders() (line 253 of /home/apache/devel/drupal/includes/database.inc).
    * Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in db_placeholders() (line 253 of /home/apache/devel/drupal/includes/database.inc).
    * Warning: array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in user_access() (line 502 of /home/apache/devel/drupal/modules/user/user.module).
    * User warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;)&#039; at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in _db_query() (line 128 of /home/apache/devel/drupal/includes/database.mysqli.inc).

So, what's the problem? When a view have multiple displays, execute_hook_menu($callbacks) in views_plugin_display_system.inc is called several times. Each time this module get a path, search for children items. In my case, admin/user/user have as children, admin/user/user/create

If a view have one display, there is no problems. But if multiple displays are processed, menu system merge all this items into a single menu, and this is not the expected behaviour...

I did a bit more of research and executing dprint_r($items['admin/user/user/create') in a hook_menu_alter() I saw this menu item structure:

Array
(
    [title] => Add user
    [page arguments] => Array
        (
            [0] => create
            [1] => Array
                (
                    [0] => system_2    <<<  This shouldn't be here...
                )

        )

    [access arguments] => Array
        (
            [0] => administer users   <<<  This two access arguments produce the error described above
            [1] => administer users
        )

    [type] => 128
    [file] => user.admin.inc
    [module] => user
    [description] => List, add, and edit users.
    [page callback] => user_admin
    [access callback] => user_access
    [load arguments] => Array
        (
            [1] => Array
                (
                    [0] => system_2    <<<  This shouldn't be here neither
                )

        )

)

A simple workaround is overwrite this children tabs in a hook_menu_alter()

/**
 * Implementation of hook_menu_alter().
 */
function admin_views_menu_alter(&$items) {
  $items['admin/user/user/create']['access callback'] = 'user_access';
  $items['admin/user/user/create']['access arguments'] = array('administer users');
}

But, in my opinion, admin_views, should take care to not return more than one time the same children tab. I didn't found a way to do that, and for this reason there is no patch here... I hope have described the problem well enough.

Comments

sun’s picture

Project: Administration menu » Administration Views
Version: 6.x-3.x-dev » 6.x-1.x-dev

admin_views is a dedicated project now; #1058638: Move admin_views into dedicated project

damienmckenna’s picture

Status: Active » Closed (won't fix)

We're sorry, but the D6 version of this module is no longer supported.