General developer forum

Hide categories from users

 
Picture of Peshali Randika
Hide categories from users
 
I created 2 custom profile fields. 1 is state. I want to hide some categories from users whose state=employee.

Is there any plugin ? I couldn't find a way to hide categories from home page. I want  to show the categories which have enrolled courses of that particular user.

Any help, Thanks inadvance !

Regards,

Peshali

 
Average of ratings: -
Davo
Re: Hide categories from users
Core developersParticularly helpful MoodlersPlugin developers

That doesn't sound like something you can do without making changes to core Moodle code - something that is strongly discouraged.

 
Average of ratings: -
Picture of Peshali Randika
Re: Hide categories from users
 

Thanks for the reply Davo ! smile

 
Average of ratings: -
Picture of Peshali Randika
Re: Hide categories from users
 

Davo ,

Is there any function to find the categories which include enrolled courses ? 

Thanks

 
Average of ratings: -
Davo
Re: Hide categories from users
Core developersParticularly helpful MoodlersPlugin developers

I don't believe there is a specific function to get all the categories that include an enrolled course. You'd have to write something like that yourself.

You could probably call enrol_get_my_courses() then loop through the results to get a list of categories that those courses are in.


 
Average of ratings: -
Picture of Peshali Randika
Re: Hide categories from users
 

Thanks Davo !  I'll look into this.

 
Average of ratings: -
Picture of Peshali Randika
Re: Hide categories from users
 

Found a way to do that smile

Define a new role for Non-Auth users. Edit the role permissions

-See hidden categories -> Prohibited

-View hidden Courses -> Prohobited

Then that user is not be able to see the category or course even by searching for it.

This is what I hope smile

Thanks everyone.

BR , Peshali


 
Average of ratings: -