Hide Participants and Reports links in Navigation?

Hide Participants and Reports links in Navigation?

by Mark Hiatt -
Number of replies: 11

It seems like there ought to be an easy-ish way to do this, huh?

How can I hide the link to Participants and to Reports, that currently appears in my Navigation between my Course Name and the start of the course materials, please? This is with Moodle v2.1.

Thanks for any help you can provide.

Mark

Average of ratings: -
In reply to Mark Hiatt

Re: Hide Participants and Reports links in Navigation?

by Hartmut Scherer -

Hi Mark,

What has been posted in "Changes in the Navigation Block" may be an answer to your request.

With kind regards,

Hartmut

What has been posted in "Changes in the Navigation Block" may be helpful for you as well.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Hide Participants and Reports links in Navigation?

by Mark Hiatt -

Thank you for taking the time to look this over for me, Hartmut. I really do appreciate it. I am not really skilled in .php. I can read it and write it if I have to, but it's often kind of scary for me. It's a muscle I need to flex, more, I'm sure, and I'm getting the experience now, with Moodle.

But I know CSS! And so the very last post in your thread really got my attention. I love the elegance of it-don't bother shutting things off or modifying how they work, just don't bother to show them!

But in Justin's code, as quoted by Ray in the last post of the thread, there are a couple of classes:

.block_navigation .type_system.depth_2 { display: none; }

...and similar. I cannot find these anywhere in our v2.1 installation. I can find several of the .block_navigation and several .tree_item, but not these two, together. And I am not certain where the .type_name are being generated and what to look for ( _setting, _system, _user, etc. ) there. What value would I plug-in there for the type_name, in that second class, to indicate Reports and Participants?

Anyone know where I can write a simple { display: none; } rule for the Participants and Reports links, in the navigation block? This looks the most promising, to me. Thanks, again!

In reply to Mark Hiatt

Re: Hide Participants and Reports links in Navigation?

by Mark Hiatt -

Yahtzee!

I got it done. It wasn't pretty, but I did get it done. I basically went into the themename.css page and, using Firebug and inspecting the element, put various background colors on elements in the long stack of the navigation sidebar. After a while, I was able to figure out, since "these" were all blue and "those" were all yellow, etc., which one I specifically needed, and wrote a rule targeting each.

I used pseudo classes like first-child and a couple of other tricks and was able to finally turn off both the Reports token (and it's marker image) and the one for Participants and its image, too. *Whew!*

I'm really happy with this. It doesn't depend upon one or another item being in location [2] of an array, or location [7]. No worries about looping or breaking loops. The page does what the page did, it just no longer displays the two tokens.

Many thanks to Hartmut and Ray for the help and inspiration!

Mark

In reply to Mark Hiatt

Re: Hide Participants and Reports links in Navigation?

by Hartmut Scherer -

Hi Mark,

I am gladd to hear that you found a solution for your site and Moodle version.

With kind regards,

Hartmut

In reply to Mark Hiatt

Re: Hide Participants and Reports links in Navigation?

by Bernd Albers -

Hi Mark

We are also discussing this topic in a German forum. Here we want to hide the following links: 

My profile settings /Messaging

My profile settings /Blogs

Does your solution work with the following CSS code, too?

 “.block_navigation .type_system.depth_2 { display: none; }”

 Then it should be something like:

“.block_settings .type_messaging.depth_2 { display: none; }”

 The “depth” number then indicates the level inside the menu?

What we have to find then is the correct expressions for

the block: My profile settings

and for the menu-entries: “Messaging” and “Blogs”

You did not by accident spot these, did you?

I’ am not very experienced with firebug and I have not found a helpful user-manual for it yet.

Could you give me a hint on how and where to start my search?

Kind regards, Bernd

In reply to Bernd Albers

Re: Hide Participants and Reports links in Navigation?

by Mark Hiatt -

Oh, Bernd, I am sorry this is so primitive.

See? I never did find the secret to these classes and their use in the site I am working on. .block_settings .type_messaging.depth_2 etc? Nowhere.

When I examined the page in Firefox, I pointed at the offending token, Reports, say, and right-clicked, selecting Inspect Element (Q). This brought up a window at the bottom of the browser with selections for 3D, HTML and Style, with a ribbon at the top showing the cascade from the top to my element. When I selected HTML, it showed me the source listing for just that part of the page. At first, I thought I could just address the offending element directly, but for me that didn't work. It was a list-item, first-child of an unordered list within a division within a division, etc. etc. Even though it had (has) an ID, I couldn't just write a rule saying li#long-number {display:none;} for some reason. So, I went up a ways and then worked my way back down. I found that I could affect the container division, <div id="content">. I set it's background color to Yellow, and sure enough much of the sidebar turned yellow. I then wrote a rule that set the next division's background color to purple. And blocks of purple showed up. From then, it was easier to see what needed to be changed. I never did find the same IDs and classes that Ray noted in his example. My CSS rule looked like this:

li.depth_3   >   ul   >   li:first-child  +  li.depth_4 {
    display: none;
    }
If you'll noodle around with it a little, I'm sure you'll make yours work, too. Good luck! And thanks again to everyone who helped.

Mark in Lincoln

In reply to Mark Hiatt

Re: Hide Participants and Reports links in Navigation?

by Jonathan Rabson -

This is a great thread.  For other people having the same issue, though, I noticed an easier way (if one's okay with the "participants" link showing up but just not displaying anything but the current student).  Under http://tracker.moodle.org/browse/MDL-26946, there's a note by Mike Walters on how to hide other participants without any fancy coding.  I'll quote it here:

"go to Site Admin > Users > Permissions > Define Roles and edit the role of Student.

Turn on the Advanced settings and search for the word 'Participants' (there will be two entries). Set both to "Prevent" and save.

The Participants links will still be there in the navigation block but a student will only be able to see their own account and no other."

In reply to Jonathan Rabson

Re: Hide Participants and Reports links in Navigation?

by Vijay N -

Hi Guys,

 

I am trying to use the above css for hiding the "Participants" link. So I used the following code (which did not work)

/* Remove "Participants/User Entry" */
.block_navigation .type_course.depth_4 { display: none; }

 

Can some one advice how to hide the participants link. I don't want students accessing the participants link in the navigation bar....Please can you advice how the css would like (or any other method) ??

Thank you

VJ

In reply to Vijay N

Re: Hide Participants and Reports links in Navigation?

by Vijay N -

Pls help for the above query?

 

V

In reply to Vijay N

Re: Hide Participants and Reports links in Navigation?

by Christian Herman -

That code is contextual, meaning it worked in his Moodle but may not work in yours. You'll need to examine the HTML from within the web browser to see what classes are attributed to the Particiapants link in your Moodle setup.  You can use the method Mark described to identify what code defined what screen element, or use Firefox and download the Firebug plugin.  Turn on Firebug and there's a function to let you click on an element in the web page and it will jump to that specific line of code.

In my Moodle setup I have only one course so I was able to go a bit simpler than Mark's code by identifying the specific class in use.  I have a user_styles.css file created (and added to the array in my theme's config.php file) to house my additional CSS rules. To that file I added the following:

/* Remove "Participants" */
.block_navigation #expandable_branch_6 { display: none; } /* Frontpage Courses menu */
.block_navigation .type_unknown.depth_4 { display: none; } /* In-course Current courses menu. Retains empty Current courses > [Course name] menu */
.block_navigation #expandable_branch_38 { display: none; } /* In-course Courses menu */

It's not perfect since it leaves an empty dropdown menu and is dependant on my very limited course setup, but it's doing what is necessary: removing the Particiapants link without commenting out large sections of core code.

HTH but YMMV

In reply to Vijay N

Re: Hide Participants and Reports links in Navigation?

by Sarah Jane -

I discovered that if you use.

/* Remove "Participants/User Entry" */
.block_navigation .type_course.depth_3 { display: none; }

this worked for me moodle 2.4.1

hope this helps any struggling