O'Reilly logo

Moodle 3.x Developer's Guide by Ian Wild

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling the Moodle login event

Recall that when a user clicks on a link to a protected resource, Moodle calls loginpage_hook() in each enabled authentication plugin. To handle this, let us first implement loginpage_hook(). In Eclipse, add the following lines to auth.php:

 /**      * Will get called before the login page is shown.       *      */     function loginpage_hook() {                 $client_key = $this->config->client_key;         $client_secret = $this->config->client_secret;         $wordpress_host = $this->config->wordpress_host;                 if( (strlen($wordpress_host) > 0) && (strlen($client_key) > 0) && (strlen($client_secret) > 0) ) {             // kick ff the authentication process             $connection = new BasicOAuth($client_key, $client_secret);          // strip the trailing slashes from the end ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required