Hi nice module, thanks, hopefully it will solve a feature request for me.

However I got the following error when trying to access my Primary Menu admin page:

Fatal error: Unsupported operand types in [...]/drupal/includes/common.inc on line 1546

I was able to resolve this with the help of this webpage:
http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x

I changed the file menu_item_access.module line 212
from
$form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');
to
$form[$mlid]['title']['#value'] = l($item['title'], $item['href'], array('attributes' => $item['localized_options'])) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');

Seems to work now but getting the following warning:
warning: preg_match() expects parameter 2 to be string, array given in /var/www/sites/sallyhansen/html/includes/bootstrap.inc on line 761.

Comments

zorp’s picture

I got the very same error... wonder if there is a conflicting module.

emptyvoid’s picture

Version: 6.x-1.3 » 6.x-1.4

Hello,
I don't seem to get this error on my current configuration.

I will research the nature of the operand error, but also I am interested in what other modules you may have installed.
I could setup a similar test environment with your module set and see if a conflict does indeed exist.

What version of PHP are you running?

Thanks,

emptyvoid’s picture

Assigned: Unassigned » emptyvoid
haggins’s picture

I get the same error after setting menu-item-access permissions.

Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch

Other access-modules:
node-access

Do you need any more information?

edit:
this works for me:
edit menu_item_access.module

change line 143-147 to

sql = "
    SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, ml.link_title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
    FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path
    WHERE ml.menu_name = '%s'
    ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";

replace line 212 with

$item['title'] = (!empty($item['title'])) ? $item['title'] : $item['link_title'];
$form[$mlid]['title']['#value'] = l($item['title'], $item['href']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');
haggins’s picture

as you can see in my last post I needed to expand the query because it only got menu titles of views (titles of node-menu-items seem to be stored only in table menu_link.link.title.
This change affected menu-item listing in the backend. Same is on the frontend where I have a little menu with one view-item and 2 node-item. Only the link to the view is visible because there are no title for the node-menu-items. I think it's the same think with the query around line 1516 but I can not follow the code how/where it generates the links. At this point you have to do the same as above:

$item['title'] = (!empty($item['title'])) ? $item['title'] : $item['link_title'];

I think this is odd because you should have the same issue on you own installation. Something very mysterious is going around here...

agerson’s picture

Version: 6.x-1.4 » 6.x-1.5

When I try to acess primery links or secondery links at:

?q=admin/build/menu-customize/primary-links

I get

Fatal error: Unsupported operand types in /Library/WebServer/Documents/drupaldev/includes/common.inc on line 1551

Disabling "Menu Item Access 6.x-1.5" fixed this issue. I would love to be able to use it.

agerson’s picture

haggins, unclear on how your fix should be applied here. I tried it with 6.x-1.5 and still got errors. Can you upload a patch file?

haggins’s picture

sorry agerson, I refused all my changes and uninstalled the module. I got everything what I need working with menu admin per role module.

My patch refers not to the first error but to the warning you get when applying the changes of #1.
"Seems to work now but getting the following warning:
warning: preg_match() expects parameter 2 to be string, array given in /var/www/sites/sallyhansen/html/includes/bootstrap.inc on line 761."

emptyvoid’s picture

Status: Active » Fixed

Issue fixed with new release.

Status: Fixed » Closed (fixed)

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