Download & Extend

No additional fieldset when editing a menu item.

Project:Menu Subtree Permissions
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hello,

I try to use the menu_stp module from cvs for the 6-x version in developement, but the additional fieldset doesn't appear when editing a menu item. Besides logs are printed on the front when admin. Perhaps somebody could remove the "print_r ($form)" in menu_stp.module on cvs version?
I'd tried before to use the version and patch found on the issue http://drupal.org/node/329079 and this fieldset appeared.

Furthermore, what I need is to give the possibility to a specific role to add item menu on a menu and not only under a menu item on this menu. Is this functionality planed to be developped ?

thank you

Comments

#1

I ran into this bug too. For now I solved it by commenting out the contents of the function function _menu_stp_has_perms_roles and adding the command 'return true'.

In other words: Change the following code in menu_stp.module:
This:

function _menu_stp_has_perms_roles($mlid, $rids, $recursive = TRUE) {
  $mlids = array($mlid);
    // If recursive, gather mids back to root.
  if ($recursive) {
    while(!empty($mlid)) {
      $mlid = db_result(db_query("SELECT plid FROM {menu_links} WHERE mlid = %d", $mlid));
      if (!empty($mlid)) {
        $mlids[] = $mlid;
      }
    }
  }
 
  // Get permission count for this sub-tree.
  return db_result(db_query(
    "SELECT count(*) AS pnum " .
    "FROM {menu_stp_roles} " .
    "WHERE " .
      "rid IN (" . db_placeholders($rids, 'int') . ") AND " .
      "mlid IN (" . db_placeholders($mlids, 'int') . ")",
    array_merge($rids, $mlids)
  ));
}

To this:
function _menu_stp_has_perms_roles($mlid, $rids, $recursive = TRUE) {                       
  $mlids = array($mlid);
  return true;
}

Ofcourse you should make a backup of menu_stp.module before changing it.

I hope it'll work for you too, but maybe it doesn't because of the other change I made to this file: http://drupal.org/node/625360 which is to avoid another bug.

It's a great module, but it needs more testing and repairing.

nobody click here