Page 1 of 1

[SOLVED] How to add Module links to menu??

Posted: Tue Feb 28, 2012 6:10 am
by SamNabz
Hi all,

Not sure if this is in the right area of the forum, so please feel free to move it if necessary.

What I am trying to do is have a link in the header menu of the administrator panel for various modules.

The reason for this is I don't want the other admins (with lower permissions) to be able to see ALL the modules. Currently I am using <?php if ($this->user->getId() == 1) { ?> to hide the 'Modules' page from the other admins, however I would like to isolate a few module links and place them in the top menu next to Dashboard, Catalog etc. for them to be able to see and use.

At the moment if I just place the link, I will constantly receive a token error and be logged off - see example below:

If I want to place a link to the 'Featured' module in my top menu and use this as the href value -- index.php?route=module/featured&token=b5c60e2a70b515e57c81dc8928e8d64a -- obviously this cannot work as the token must be generated each time you click on the Featured module link through the 'Modules' page.

Any information on how to do this is greatly appreciated.

Re: How to add Module links to menu??

Posted: Tue Feb 28, 2012 6:48 am
by affect
Token is stored in the session so you should be able to use $this->session->data['token'] in the admin templates to build the links correctly.

Also you might want to create a different group with less permissions for other admins instead of adding them to top administrators group. You should then be able to restrict their access/modification permissions to different administration areas. If you just hide the modules page, they'll still be able to access it by typing in the corresponding URL so that's definitely not the best way to do it.

Re: How to add Module links to menu??

Posted: Tue Feb 28, 2012 7:32 am
by SamNabz
affect wrote:Token is stored in the session so you should be able to use $this->session->data['token'] in the admin templates to build the links correctly.
Hi affect,

Thank you for the prompt reply.

Could you please elaborate on that? If you could give me an example of what the link should look like that would be great.
affect wrote:Also you might want to create a different group with less permissions for other admins instead of adding them to top administrators group. You should then be able to restrict their access/modification permissions to different administration areas. If you just hide the modules page, they'll still be able to access it by typing in the corresponding URL so that's definitely not the best way to do it.
I do set the permissions via user groups to restrict access etc. but I also hide the modules page.

Re: How to add Module links to menu??

Posted: Tue Feb 28, 2012 8:14 am
by affect
You admin template links will then look somewhat like this:
<a href="index.php?route=module/featured&token=<?php echo $this->session->data['token']; ?>">Featured</a>

Re: How to add Module links to menu??

Posted: Tue Feb 28, 2012 9:12 am
by SamNabz
Thanks affect, that worked perfectly!

Much appreciated mate.

Re: [SOLVED] How to add Module links to menu??

Posted: Fri Jan 29, 2016 11:33 pm
by rmandiga
@affect: Thanks for your help. I was struggling long for this solution.

*******