Forums | Mahara Community

Mahara/Moodle integration /
Landing on mahara dashboard


Jason Dong's profile picture
Posts: 33

18 July 2016, 23:02

Hi, everyone,

We need this function urgently to set up our mahoodle evironment. The backgroud is that we successfully setup moodle and mahara and moodle users could sso to mahara manually.But what we need is to force all users to land on mahara dashboard after logged in. I guess we have to do something inside login.php in moodle,but not sure with that. Please kindly advice us on this and share with us your code if you have experience on this.

Best Regards

Jason 

Kristina Hoeppner's profile picture
Posts: 4853

19 July 2016, 6:47

Hello Jason,

If you want your users to log in via Moodle but be re-directed to Mahara automatically, I think you need to put the "External login page" config value into your Mahara config.php. You can find this value and a description in /lib/config-defaults.php around line 371 under "External login page".

Cheers

Kristina

 

Andrew Field's profile picture
Posts: 10

20 July 2016, 0:36

What Kristina describes, in perfect detail, is exactly what we do.  Works really well.

We're upgrading to the latest Mahara soon. The guidance for setting up your Mahoodle can be found here: http://manual.mahara.org/en/16.04/mahoodle/mahoodle.html.  It can initially look complex, but it all does make sense.

Jason Dong's profile picture
Posts: 33

20 July 2016, 2:39

Andrew and Kristina,

Thank you for your help.But I am getting a little confused here, please comment on the following statement:

1. My understanding for a mahoodle setting when Moodle is master and Mahara is slave is that users have to be authenticated by Moodle.

2. In such a setting, users can sso from Moodle to Mahara but not the other way around.

3. If these statement are all true, it shoud be Moodle's login.php to handle users login request. It will authenticate the user firstly and then decide where the user should go(default landing page or others).Why should we cook mahara's config.php to alter the users going(landing page)? 

4. Moodle as master and Mahara as slave is the vast majority of connections because only then can we take advantage of the Moodle portfolio export feature and the Mahara assignment submission plugin in Mahara.(quote partially from Kristina from other threads)

Best Regards

Jason 

Kristina Hoeppner's profile picture
Posts: 4853

20 July 2016, 8:04

Hello Jason,

I can't give you the technical details why you'd make the change in the Mahara config.php, but that's the way it's been made possible. As far as I understand, it only sends you to the Moodle login page and then takes you back to Mahara. Give it a try on your testing environment and see if it works. Moodle would still be the master and Mahara the slave.

Cheers

Kristina

 

Jason Dong's profile picture
Posts: 33

21 July 2016, 1:16

Hi, Kristina

I copied the line $cfg->externallogin = 'http://moodle.example.com/auth/mnet/jump.php?hostwwwroot={wwwroot}&wantsurl={shorturlencoded}'; in the /lib/config-defaults.php , changed "http://moodle.example.com" "{wwwroot}" and "{shorturlencoded}" to my relevant address. Then I put this line in my mahara's config.php, but nothing happened.

Does it matter where I put this line within the config.php?or is there any other issues I might disregard?

Best Regards

Jason

Aaron Wells's profile picture
Posts: 896

21 July 2016, 11:07

Hi Jason,

The config line can go anywhere in your config.php (well, anywhere below the starting line that sets "$cfg = new stdClass();").

The documentation is a little vague, but the literal "{wwwroot}" and "{shorturlencoded}" need to be included in the config, rather than replaced. They act as placeholders which Mahara automatically identifies and changes as needed. The only part you should change is the "http://moodle.example.com". So for instance if you were trying to make it work with moodle.org, you'd put this in your config.php:

$cfg->externallogin = 'https://moodle.org/auth/mnet/jump.php?hostwwwroot={wwwroot}&wantsurl={shorturlencoded}';

If you want all Mahara users to always log in via Mnet on Moodle and never via Mahara's built-in login form, then I'd recommend also setting $cfg->showloginsideblock = false;

Cheers,

Aaron

Jason Dong's profile picture
Posts: 33

22 July 2016, 3:37

Hi, Aaron

Thanks for your explanation. It worked very well except one thing. When I visited my mahara URL, it didn't jump automatically to my moodle's login page, it showed an arrow with "login" on right hand and the login form disppeared. I could click on the arrrow icon and access moodle login page and after my login, my landing page was my dashboard in mahara. But can I being transfered to moodle's login page directly without going through the intermediate page(I know it's mahara's login page without login form)?

Best Regards

Jason

Aaron Wells's profile picture
Posts: 896

22 July 2016, 11:13

You'd need to hack Mahara to do that. The simplest way might be to make the dashboard/home page only available to logged-in users; then when someone visits your Mahara site's homepage, they'll get redirected to the login screen, which in this case is Moodle.

To do that, just comment out or delete this line from Mahara's htdocs/index.php file. You should find it near the top:

define('PUBLIC', 1);

Cheers,

Aaron

Jason Dong's profile picture
Posts: 33

22 July 2016, 13:11

Hi, Aaron

It works perfectly well.

Thanks a lot

Jason

10 results