Hidden categories clickable in essential breadcrumb

Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -
Number of replies: 14

Hi,

Last weeks i spent a lot of time doing google searches about the breadcrumb trail in the essential theme.

Due to various reasons i have a number of courses that I make available through a hidden category. Now i don't want users to be able to click on a hidden category in the breadcrumb trail and see the other courses in that category.

When I login as an admin I can see these hidden categories being italic and light gray in the breadcrumb. Apparently the code recognizes these categories  as hidden. So i guess it should be possible to make these categories not clickable for users. However i can't find a solution for this and have no idea where to start myself.

Any ideas would be most welcome here.

Thanx,

Peter

Average of ratings: -
In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

https://docs.moodle.org/24/en/Course_categories

Chapter 4 - https://docs.moodle.org/24/en/Course_categories#Hiding_categories

Explains it in detail.

To test use the Moodle Demo site, you will find  link to it at the top of the page. Login in as Admin, create a Category, hide it and then login as a Student and see if you can find it!

Hope this helps?

Mary

In reply to Mary Evans

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

Hi Mary,


Thanx.

This chapter doesn't say anything about the use of breadcrumbs. The problem is not if a student can or can't find a course. The problem is that the hidden category name is visible in the breadcrumb trail AND clickable is. Clicking on a hidden category results in an error (unknown category) and thats not nice.

The attached file shows a category ("diensten") below the hidden category ("extra"). I don't want the hidden category clickable in the breadcrumb.

http://www.platformvoorprofessionals.nl/course/index.php?categoryid=10

Peter

Attachment mary.gif
In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

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

Is the functionality the same or different in the Clean theme?

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

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

Looking at Essential's navbar() method in core_renderer.php and the parent version in /lib/outputrenderers.php then they are functionally the same in this context.  Thus this issue would be true of all themes.

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

Gareth,

The functionality is the same. The results ditto.

Peter

In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

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

In that case you need to copy this: https://github.com/gjb2048/moodle/blob/MOODLE_28_STABLE/lib/outputrenderers.php#L3138-L3182 into Essential's core_renderer.php file and adapt it.

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

OK Gareth, thanx.

I'm afraid i need a little assistance here. I get the copy part of your message (just completed the copy paste exercise) but how do i adapt this function?

Peter

In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

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

Hi Peter,

I've shown you the door, for me to decorate the room for you transitions into work for me and thus time = money.

Kind regards,

Gareth

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

Didn't see that coming. Thanks for now smile

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

Gareth,

Thanx for showing me the door. I finally managed to make the function available in core_renderer.php. Unfortunately this does not work as desired because the function doesn't see the difference between a hidden category and a visible category.

I did some testing: the $item is never hidden, except for the admin. Which seems strange to me while this function is available for all themes.

Peter

In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

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

Does 'Extra' have the class 'dimmed_text' added to it's link and do the others not have it?

In reply to Gareth J Barnard

Re: Hidden categories clickable in essential breadcrumb

by Peter Haasdijk -

Gareth,

Sorry for the late response. Because I did not find the answers I was looking for on the forum I decided to let the matter rest. So, I have reorganized the site and no longer use hidden categories. At least for now.

Thanks for the help.

Peter

In reply to Peter Haasdijk

Re: Hidden categories clickable in essential breadcrumb

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


I've just looked at this again and in fact there is no problem to solve.  This is because the core Moodle decides against the roles / capabilities etc. if a hidden category appears for a user.  If it does then its dimmed by the theme in terms of styling, but should be still clickable as the user has access to the hidden category.  If however, they are a 'student' then the category will not be presented to them in the first place.  Just tested on my dev system with a 'student' account to verify.  Therefore if its shown, then it should be clickable to see what else is in that category.


Cheers,

Gareth