Complete re-write

dwees - July 20, 2008 - 14:06
Project:OG Menu
Version:5.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

As I needed this module for a project, and this module didn't work, I wrote my own version. Here is the text from the README.txt file I produced. I've done some testing on this module, but have not yet used it on a production site, so test it out yourself. Make sure to set up the access permissions correctly. Read below.

This module allows users to create a single menu block for their Organic Group. These menus are restricted
to either include nodes from the group, or menu items within this small section. If you wish, you can re-use
part of your site menu tree (but only users with 'administer og menus' or 'administer all menus' have permission
to do this) in your OG menu. Note that if you do this, any changes made to the local OG menu will affect that
part of the whole tree.

This module requires that all users able to create menus be given the permission 'administer menus'.
However, once you enable this module, 'administer menus' is no longer sufficient to have access to
admin/build/menus, users must also be given a new permission 'administer all menus' available in the
access permissions for this module.

The permission 'administer og menus' allows a user to administer any menu for any organic group. The
permission 'administer own og menus' allows an administrator of an organic group to add/create/edit
a single menu for that group.

This module modifies the add/edit menu item form so that a user (who has javascript enabled due to the
features of this modification) to add menu items using nodes created in the group in question.

It also modifies the node/add form so that if a node is being added to a group, and the group has a menu, the
possible menu parent items are restricted to the Og menu for that group. If the group does not yet have a menu,
this module unsets $form['menu'], preventing users from adding their menus to the wrong place.

In order to completely prevent 'admin/build/menu' from being accessible to the wrong users, you
unfortunately also need to copy the following code into your template.php file (see drupal.org on the
use of a template.php file).

/**
* This function overrides the permissions for the admin/build/menu page. Permissions for the subpages
* are handled by hook_form_alter.
*/
function phptemplate_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) {
// make sure we are on the right page
if (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'menu' && !arg(3)) {
// first check to make sure this user has access to this.
if (module_exists('og_menu') && !og_menu_admin_menu_access()) {
drupal_access_denied();
module_invoke_all('exit');
exit();
return;
}
}
else {
// send back the regular item list.
return theme_item_list($items, $title, $type, $attributes);
}
}

Note that this is not a patch of the old module. Also note that you will have to rename the file extension to .tar.gz in order to unpack this file.

Dave

AttachmentSize
og_menu_complete_rewrite.tar_.gz6.7 KB

#1

guix - October 8, 2008 - 08:27

Hi,

Thanks, it's working very well. Only thing, I'd like to be able to show these menus on ANY node that belongs to the group, not the group node only (group homepage). I'll try to modify your code to do this.

And Leonk... what are your plans with that module ?

#2

dwees - October 8, 2008 - 12:28

Actually I've made the modification you just asked for and fixed some of the settings with the menu items being displayed on node forms where it makes no sense (the node form in question isn't being posted to a group).

I'll post my small modifications tomorrow when I get back to work.

Dave

#3

guix - October 21, 2008 - 15:53

Hi dwees, thanks for the modification, could you upload it some time ?

#4

SocialNicheGuru - January 15, 2009 - 18:11

can this be uploaded to the OG menu page on Drupal.org?

#5

SocialNicheGuru - January 16, 2009 - 08:59

I get this error when i tried to use:

user warning: Unknown column 'nid' in 'field list' query: INSERT INTO og_menu (mid, nid) VAlUES (90, 10761) in /var/www/vhosts/beta.activelyOUT.com/httpdocs/drupal5/includes/database.mysql.inc on line 174

#6

SocialNicheGuru - January 17, 2009 - 15:28

First I want to say THANK YOU for doing this!

I just installed the module. I also installed OG subbed groups.

I get this error:

user warning: Unknown column 'nid' in 'where clause' query: SELECT o.mid, m.title, m.type FROM og_menu o INNER JOIN menu m ON o.mid = m.mid WHERE nid = 10811 in /var/www/vhosts/mysite.com/httpdocs/drupal5/includes/database.mysql.inc on line 174.

#7

wesku - March 7, 2009 - 15:47

I needed easy to use shared bookmarks / menu for each group and created a OG Bookmarks module for it some time ago. The module has just been published and it can also be used for managing group menus. The main difference between OG Menu and OG Bookmarks is that permissions for managing bookmarks can be very limited and users do not need access to menu administration. The module is very close to bookmarks module, but it has been adapted for group use instead of personal.

Please have a look and let me know what you think: http://drupal.org/project/og_bookmarks

#8

dwees - March 8, 2009 - 00:03

re: ActivelyOut

Try adding an integer NID column to the table in the database using PhpmyAdmin or a similar tool. It sounds like the installation script that comes along with this module isn't working...

Dave

#9

tjmoyer - March 30, 2009 - 16:14

Any chance you'll develop a version for drupal 6? This module sounds like just what I need, but I can't enable it as it's not compatible.

#10

ramsalt - April 16, 2009 - 09:49

I think this is the road to go with og_menu. Much more like the functionality actually needed.

Are you still working on it? And how is the communication with the maintainer of the existing og_menu?

#11

jide - September 23, 2009 - 01:34

Seems much better than the current version, would be nice if maintainers could have a look at it.
I may convert this to a 6 version, I'll post it here in this case.

#12

muschpusch - October 27, 2009 - 15:00

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.