Download & Extend

'Parent item' settings on 'admin/build/menu/item/%itemid/edit' shows ALL menus, not only user has access to

Project:Menu Access
Version:6.x-1.8
Component:Code
Category:bug report
Priority:normal
Assigned:emptyvoid
Status:closed (fixed)

Issue Summary

If user has access to some menus - he must see only that menus in 'Parent item' setting. Now, user see ALL the menus available in Drupal.

Seems it fixes by this code:

<?php
function menu_access_form_alter(&$form, $form_state, $form_id) {
 
/* original part skipped */
 
 
if ($form_id == 'menu_edit_item') {
   
$item = $form['menu']['#item'];
   
$form['menu']['parent']['#options'] = menu_parent_options(menu_access_get_menus(), $item);
  }
}
?>

Please test it. Thank you.

Comments

#1

Also you need to alter node edit form. Changes:

<?php
 
if ($form_id == 'menu_edit_item' || isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id) {
   
$item = $form['menu']['#item'];
   
$form['menu']['parent']['#options'] = menu_parent_options(menu_access_get_menus(), $item);
  }
?>

#2

Assigned to:Anonymous» emptyvoid

Hmm do you have a patch I can apply and test against?

#3

Status:active» needs review

I am going to conduct testing on the current release and if the issue is confirmed review your change then test.

#4

#5

Are there any updates with this issue?

It would be nice to get this issue sorted out, especially if the proposed solution above works. If I can help in any way, let me know.

#6

I finally had some time to test Taran2l's code above, and it seems to work just fine when editing a node or editing a menu item.

Here's a patch that others can test with. If this does the trick, let's get it committed!

AttachmentSize
menu_access-618828-6.patch 637 bytes

#7

thanks for the patch, as soon as I get my CVS account reactivated I will issue a new release to the dev branch for testing. I have several other patches and feature enhancement that I would like to roll into the next release.

#8

I have committed your patch to the dev branch, please download the test and let me know if it fixes the problem for you. I will roll this into the next release.

#9

Status:needs review» patch (to be ported)

#10

I just tested using the latest dev release and it fixes this issue.

#11

Status:patch (to be ported)» fixed

Fixed in 6.x-1.9.

#12

Status:fixed» closed (fixed)

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

nobody click here