Moodle URL not added to page access email

Bug #1221708 reported by Luke Stirk on 2013-09-06
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

We have a Mahara site connected to Moodle. On all emails received so far the URLs have the Moodle URL and then the Mahara URL as the destination eg:

But this is not happening when sharing your page with users. The URL the user gets is just the standard Mahara URL which then takes them to a login page but the users do not have a login for Mahara only for the Moodle. Can the URL in this email be changed so behave in the same way as others such as Friend request and Group invite?


Luke Stirk (luke-stirk) on 2013-09-06
description: updated
Aaron Wells (u-aaronw) wrote :

It appears that what's causing this bug is the following:

1. In email_user(), we do a find/replace of all URLs for the MNet URL

2. BUT, we only do this if the $user passed in to the function has a flag set that indicates that they are on MNet

3. Most Activity types use the function activity_get_users() to get the list of users who should receive the activity. This function populates the MNet flags for each user.

4. But the ActivityTypeNewview, which is what sends out "shared view" notifications, instead uses the function activity_get_viewaccess_users(), which doesn't populate the MNet flags.

So the solution is to populate the MNet flags for the users generated by activity_get_viewaccess_users()

Changed in mahara:
status: New → Confirmed
importance: Undecided → Medium
tags: added: activities email mnet notifications
Luke Stirk (luke-stirk) wrote :

Is there likely to be a fix any time soon?


Did you set the config value for externallogin?

You can set a config value to redirect you to the Moodle login page. See htdocs/lib/config-defaults.php and search for "externallogin" to get to the part where this feature is discussed.

This should allow all regular URLs to be redirected to the proper login page (and then back).

Aaron Wells (u-aaronw) wrote :

Hi Luke,

I've identified the general outlines of the fix we need in my previous comment, but the Mahara developers in my office are pretty booked up right now, so we will probably not have the time to implement a fix immediately. It could happen faster if a member of the community outside of our organization decides to fix it.

In the meantime, using the externallogin feature that Kristina described, should be a pretty good workaround.


Luke Stirk (luke-stirk) wrote :


Thanks for the replies. The config value sounds good however we have 2 separate Moodles accessing one Mahara so the URL really needs to be pulled through from the institution.

Is there a bugfix for this problem?

Robert Lyon (robertl-9) wrote :


I've taken what Aaron mentioned back in 2013 and created a patch based on his idea.

The patch is here

I've not been able to fully test it yet so if others want to test it and let me know if it works or not that would be good


Changed in mahara:
milestone: none → 17.04.0
status: Confirmed → In Progress

Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 60473009d04b4cf09afe826e773a28b54832a527
Author: Robert Lyon <email address hidden>
Date: Tue Nov 15 09:40:05 2016 +1300

Bug 1221708: Adding mnethostwwwroot and mnethostapp values to results

For the activity_get_viewaccess_users() function to make it similar to
activity_get_users() so that we can have the correct remote url in the
email message.


Change-Id: If04d8f7ee8e5d0bb168774f206d4fb964bb53b12
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9) on 2017-02-15
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2017-04-27
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers