moodle 3.6.8 on redhat 7.8 64 bit and mysql 7.7 and php 7.2.x
I am trying to learning moodle and one of the simple things I wish to learn is to how check if a user has already logged in to page I have built (a simple hello world string) and only those that have moodle administrative role are able to view that page.
For example my page, called test.php is located at https://ourmoodle.url.com/whatever/ folder
if a user tries to go to https://ourmoodle.url.com/whatever/test.php, it should first check to see if they have logged in and if not, they are redirected to the login page.
If they are logged in already, it checks to see if they are part of administrative group.
How do I accomplish that in my test.php page?