Hi,

Could someone point me in the right direction to make certain menu's only available to certain role's? For example, i want to have a members only menu which you have to subscribe and be added to the custom made 'member' role. No one else should be able to see it.

any help would be appreciated.

Brad.

Comments

tostinni’s picture

If you put your menu in a custom block, then you could use the new way to hide drupal's block : Provide a 70x5 textarea in which I can a write a block's "visbility check" using Drupal's APIs.

Take care, it's only available from CVS for the moment.

evolve’s picture

I am currently using Drupal 4.5

Using that version there is no way to hide a menu / block from a certain role?

Brad.

tostinni’s picture

I made an old patch, that's now deprecated but that applyed to 4.5
It was to allow block visibility by roles.
But why don't use CVS version of block.module ?
You just have to change the block table regarding new schema from 4.6 and the modification that block visibility textarea introduced, but it's not so tricky.

evolve’s picture

how would one apply a patch? I'm still getting used to all this ;)

thanks!

Brad.

evolve’s picture

Figured it out...

as it turns out your patch is actually applicable to the block.module v 1.144 the version distributed with drupal 4.5 is 1.139.

Downloaded 1.144 off the CVS, manually added the applicable table fields (pages, visibility and roles) and dropped in the new block.module file and it worked.

As a note to others reading this: Be sure to setup the table PROPERLY otherwise drupal will hiccup and you will lose all your blocks info. Before you do this, backup your DB (as i did, lost the blocks SQL info but just reuploaded it).

thanks for the great info,

Brad.

tostinni’s picture

Well, I hope you won't find some troubles with this patch (pretty ugly, I would say :) ). In fact on April 13, I made another one a little clearer...

But, as this solution wasn't keeped for block visibility, I would advise you to wathc out CVS version of Drupal, and update it as soon as the new stable version would be roll out.

Anyway, if you have any problem, feel free to contact me.

edrex’s picture

With non-cvs drupal, you'd need to make a module ( yourmodule.module ) with a function yourmodule_access for registering the permission (eg, "Access Custom Menu") and yourmodule_block for creating the block with the menu in it. Then enable the module, and change the allowed roles.

evolve’s picture

hmmm, didn't realize just making permissions based menu's would be so involved...

thanks for the info though...

Brad.