Joomdle 1.0 Installation

Using Joomdle and Moodle's "Autoenrol Cohorts"

  • cjdelrea
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago #1 by cjdelrea
First, I want to say that I've been using Joomdle for about 4 years and I'm very happy with it. Thanks to the developers for creating and maintaining this tool.

Now my problem. Our administration wants users that register with an email from a specific domain to be automatically enrolled into specific courses. I gave the Moodle plugin "Autoenrol Cohorts" ( moodle.org/plugins/auth_mcae ) a shot. That module allows me to automatically create cohorts based on a user's email domain.

When a user logs in via Moodle, it triggers the Autoenrol Cohorts plugin and automatically places that user into the correct cohort. The problem is, it appears that Joomdle skips Moodle's user_login() function, which is the function that triggers this plugin.

Is it possible for me to use Joomdle and have it trigger Moodle's Autoenrol Cohorts module?

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic Using Joomdle and Moodle's "Autoenrol Cohorts"
Thanks for the kind words. We really appreciate it.

As for your question: I took a quick look at autoenrol plugin's code, and I guess the problem is that Joomdle does not trigger "user_authenticated_hook" event when user logs in from Joomla.
I will look more into this as soon as I can, and get back to you.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #3 by Antonio Durán
Replied by Antonio Durán on topic Using Joomdle and Moodle's "Autoenrol Cohorts"
I tested the plugin and at first I had the same problem as you: it did not create the cohort when I logged with a Joomdle user, trying from Joomla or Moodle.

For Moodle, problem was easy to solve: as I have it configured to use redirection for SSO, Joomdle was preventing any other auth plugins from executing code on user_authenticated_hook function, which Autoenrol cohorts uses.
Solution is to move up the Autoenrol plugin in the Manage authentication page, so that it is above Joomdle. After that, cohort is created.

For Joomla, problem needs some coding to solve, as the issue is that it is not calling the user_authenticated_hook function. I have added the code locally and it seems to be working fine, adding cohorts now.
In case you want to do the change:
File to edit: moodle/auth/joomdle/land.php
After:
Code:
$user = get_complete_user_data('username', $username); complete_user_login($user);
Add:
Code:
// Call user_authenticated_hook $authsenabled = get_enabled_auth_plugins(); foreach ($authsenabled as $hau) { $hauth = get_auth_plugin($hau); $hauth->user_authenticated_hook($user, $username, ""); }

Please test and let us know.

Please Log in or Create an account to join the conversation.

  • cjdelrea
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 10 months ago #4 by cjdelrea
Replied by cjdelrea on topic Using Joomdle and Moodle's "Autoenrol Cohorts"
Thanks Antionio! That did the trick.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #5 by Antonio Durán
Replied by Antonio Durán on topic Using Joomdle and Moodle's "Autoenrol Cohorts"
Great, thanks for the feedback.

Please Log in or Create an account to join the conversation.