Essential theme - Restricting dropdown menu options for students

Essential theme - Restricting dropdown menu options for students

by Doug Moody -
Number of replies: 13

I am using 3.1 with Essential theme.

The attached screenshot is what a student sees at the upper right corner below their login.

I want to restrict them from being able to access some of these menu items.

Does anyone know how to do that? If so, please share.

Thank you!

(Edited by Helen Fosterto mention Essential theme in the subject - original submission Tuesday, 16 August 2016, 10:48 PM)

Attachment moodlemenu.jpg
Average of ratings: -
In reply to Doug Moody

Re: Restricting options for students

by Ryan Hazen -

Try site administration > appearance > themes > theme settings 

Then scroll down and look for "user menu items" and configure your user menu that way. Here's a screen shot including the instructions for defining this menu:

user menu items

In reply to Ryan Hazen

Re: Restricting options for students

by Doug Moody -

Ryan,

Thanks for the tip, but unfortunately, that doesn't affect the menu I showed. 

Any other ideas?

In reply to Doug Moody

Re: Restricting options for students

by Doug Moody -

Is it possible that this issue is related to permissions? If so, which ones?

But I am out of ideas. Really need to get a handle on this please!

In reply to Doug Moody

Re: Restricting options for students

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In reply to Howard Miller

Re: Restricting options for students

by Doug Moody -

Howard,

thank you for the reply. I appreciate it very much.

That said, as I looked at the code you provided, that portion of the code says in the comments that it is first looking to see if the user has the permissions. For example:

// Check if user is allowed to view discussions.
if (has_capability('mod/forum:viewdiscussion', $context)) {
$branchlabel = '<em>'.$this->getfontawesomemarkup('list-alt').get_string('forumposts', 'mod_forum').'</em>';
$branchurl = new moodle_url('/mod/forum/user.php', array('id' => $USER->id));
$usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));
$branchlabel = '<em>'.$this->getfontawesomemarkup('list').get_string('discussions', 'mod_forum').'</em>';
$branchurl = new moodle_url('/mod/forum/user.php', array('id' => $USER->id, 'mode' => 'discussions'));
$usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

So, if it is checking for a permission, what is it doing if the permission is not there? It seems that turning off that permission ought to stop the user from going further. What am I missing?

In reply to Doug Moody

Re: Restricting options for students

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Probably nothing... BUT... be aware that the has_capability() call checks for a capability for that user in a given context. That depends on the role(s) they have been given in that context. 

A quick glance at the code implies that the check is made in course context. So, I would expect that (for example) taking away mod/forum:viewdiscussion in the student role would stop students seeing that link in courses. Obviously, it would also stop them using the forums. Is that what you wanted?

If it doesn't, it suggests a bug to me. Or some further investigation at least. These are the sort of things that never get tested wink

In reply to Howard Miller

Re: Restricting options for students

by Doug Moody -

Howard,

You are right. That is my dilemma. I really don't want to lose forums capability, if I put it in my lessons. I just don't want them to have the ability to visit forums, or send messages, etc., unless I specifically make it a part of a lesson

Hard coding this makes for great menus and a great theme. However, as the admin and teacher, I want control of when certain things are presented to students. Having that menu there at all times is actually a bad thing, although it appears attractive at first glance.

I think the developer of this theme has done a wonderful job at coding with an attractive theme, but should allow anything that is hard coded to be backed out of by the admin easily without having to resort to code. I would suggest maybe some more lines of "IF" code that checks to see if there is an instance of something, like a forum, or messaging, or badges, etc.,  and if so, allows that drop down menu item to show, otherwise (ELSE), it should be off by default.

For me, I only have a few days left to go live with this, so I will have to pick another theme (sad face). Sure wish I could have used Essential. Thanks to all for your engagement.

In reply to Doug Moody

Re: Restricting options for students

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Really - you are just saying that the theme doesn't work how you would like it to. 

In the nicest way, I think your requirement is unusual. It's quite easy to stare at some "outfield" requirement for so long that it starts to become entirely logical and you can't understand why an option doesn't exist for it. However, every additional option adds to the potential for confusion. 

Anyway, I am not the maintainer of this theme. You should probably add an Issue in Github. Sometimes these things get amended very quickly if the maintainer thinks it's a good idea.

In reply to Howard Miller

Re: Restricting options for students

by Doug Moody -

Howard,

It's not that it's an outfield requirement. I teach middle school, and students that age should not have access to some of those things. 

Yet, the essential theme is great otherwise. Were I a designer, I would certainly not hardcode something that takes away the capability for the admin to modify it. That goes for ANY theme, not just this one.

It so happens that I like essential a lot. But still, Moodle allows so much customization that that is the reason it has become a worldwide phenomenon for learning. People love to have the ability to customize it the way they want, and so because this theme has taken away that capability it actually lessens the greatness of Moodle.

I'm just sayin...

In reply to Doug Moody

Re: Restricting options for students

by Ryan Hazen -

Sorry for being late on getting back to this - this looks like an Essential issue. Maybe bring it up with the maintainer? That user menu customization piece is really handy in the the theme settings and works like a charm in core themes. Sorry I wasn't more help - hope you get this worked out! 

In reply to Ryan Hazen

Re: Restricting options for students

by Doug Moody -

Ryan,

Not your fault at all. I would have offered the same advice, but the Essential theme is a horse of a different color. It actually takes away capabilities in trade for a prettier looking page. I hope the maintainer reads this!

In reply to Doug Moody

Re: Essential theme - Restricting dropdown menu options for students

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Doug, as this discussion has turned out to be specifically about the Essential theme, I have edited your initial post to clarify the subject line and will move the discussion to the themes forum.

In reply to Helen Foster

Re: Essential theme - Restricting dropdown menu options for students

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, I am the current maintainer of the theme as it states at the top of https://moodle.org/plugins/theme_essential.

So, a few points, positive and negative:

  • If this post was placed in the themes forum in the first place - Essential IS a theme - then I would have seen it on the day it was originally posted.  Please, please, please browse the list of forums and do a bit of work (for your benefit) to find the one best suited to it, then it will be seen sooner and you'll get a reply sooner too.  This is after all in the site policy that everybody who has a login signed up to: https://moodle.org/mod/page/view.php?id=7080.
  • RE: "Were I a designer, I would certainly not hardcode something that takes away the capability for the admin to modify it." - its not hard coded!  In fact there is a greater degree of granularity that you can apply with the capability restriction at the course context (remember that the main site is a a course too) than the global effect of the custom user menu in core.
  • The custom user menu items functionality in core came after Essential had already implemented its solution (I believe).  I did notice its arrival and considered migrating but did not like the way it was implemented, so did not.
  • One size does not fit all, I do have to make decisions based on several things: Will it break / contradict the true greatness of the original theme as first designed by Julian at 30,000 feet?  Is it a good new and innovative functionality?  Will I learn from it?  If I don't think I can learn from it, then can I get funding for it (time is money and we all have to eat)?
  • RE: "It actually takes away capabilities in trade for a prettier looking page." - I totally and utterly disagree!  Whist there is the 'style' of Essential, there is so much functionality under the hood that goes over and above what is implemented in core Moodle (I'm not being negative about core though) - to the extent that it builds upon it like a well oiled machine.
  • I do have code in other themes that implements custom menus and even restricts on having specific links for a given language only.  But at the moment this may contradict what is already in Essential.  I'll have to think.  But.... as it is not a bug then something I'm not going to 'fix' for free at the current moment in time (see above criteria).

Average of ratings: Useful (2)