General developer forum

Check if user has access to activity by code

 
Picture of Percy Astocaza
Check if user has access to activity by code
 

Hello,

I'm making a custom report and i'm listing all the activities from a course, but I should only print the activities that the user has access to. The course has groupings.

Is there a method for that? Thanks!

 
Average of ratings: -
Picture of Mark Johnson
Re: Check if user has access to activity by code
Core developersParticularly helpful MoodlersPlugin developers

The cm_info class has a "uservisible" property, which should tell you whether or not the current user has access to that activity.

 
Average of ratings: -