Commit 79865c29 authored by Richard Mansfield's avatar Richard Mansfield

Use subdomain URLs on Settings and Edit view pages (bug #1006634)

When user subdomains are enabled, display the Profile url field on the
Settings page where it belongs: between the scheme part of the url and
the rest of the wwwroot.

On Edit Title & Description for profile pages, ensure the correct form
of the clean url is used by calling the appropriate function instead
of building the url.

Change-Id: Id4924165e7bf803fce46cf877a980d0c235176eb
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent bd1b7ff3
...@@ -89,11 +89,21 @@ if (get_config('cleanurls') && get_config('cleanurlusereditable')) { ...@@ -89,11 +89,21 @@ if (get_config('cleanurls') && get_config('cleanurlusereditable')) {
$elements['changeprofileurl'] = array( $elements['changeprofileurl'] = array(
'value' => '<tr><td colspan="2"><h3>' . get_string('changeprofileurl', 'account') . '</h3></td></tr>' 'value' => '<tr><td colspan="2"><h3>' . get_string('changeprofileurl', 'account') . '</h3></td></tr>'
); );
if (get_config('cleanurlusersubdomains')) {
list($proto, $rest) = explode('://', get_config('wwwroot'));
$prehtml = $proto . ':// ';
$posthtml = ' .' . $rest;
}
else {
$prehtml = get_config('wwwroot') . get_config('cleanurluserdefault') . '/ ';
$posthtml = '';
}
$elements['urlid'] = array( $elements['urlid'] = array(
'type' => 'text', 'type' => 'text',
'defaultvalue' => $USER->get('urlid'), 'defaultvalue' => $USER->get('urlid'),
'title' => get_string('profileurl', 'account'), 'title' => get_string('profileurl', 'account'),
'prehtml' => '<span class="description">' . get_config('wwwroot') . get_config('cleanurluserdefault') . '/</span> ', 'prehtml' => '<span class="description">' . $prehtml . '</span>',
'posthtml' => '<span class="description">' . $posthtml . '</span>',
'description' => get_string('profileurldescription', 'account') . ' ' . get_string('cleanurlallowedcharacters'), 'description' => get_string('profileurldescription', 'account') . ' ' . get_string('cleanurlallowedcharacters'),
'rules' => array('maxlength' => 30, 'regex' => get_config('cleanurlvalidate')), 'rules' => array('maxlength' => 30, 'regex' => get_config('cleanurlvalidate')),
); );
......
...@@ -90,13 +90,14 @@ if ($studentid !== '') { ...@@ -90,13 +90,14 @@ if ($studentid !== '') {
if ($urlallowed = get_config('cleanurls') && $view->get('type') == 'portfolio' && !$institution) { if ($urlallowed = get_config('cleanurls') && $view->get('type') == 'portfolio' && !$institution) {
if ($group) { if ($group) {
$groupdata = get_record('group', 'id', $group); $groupdata = get_record('group', 'id', $group);
$urlallowed = $urlallowed && strlen($groupdata->urlid); if ($urlallowed = !is_null($groupdata->urlid) && strlen($groupdata->urlid)) {
$cleanurlbase = get_config('wwwroot') . get_config('cleanurlgroupdefault') . '/' . $groupdata->urlid . '/'; $cleanurlbase = group_homepage_url($groupdata) . '/';
}
} }
else { else {
$userurlid = $USER->get('urlid'); $userurlid = $USER->get('urlid');
if ($urlallowed = ($urlallowed && !is_null($userurlid) && strlen($userurlid))) { if ($urlallowed = !is_null($userurlid) && strlen($userurlid)) {
$cleanurlbase = get_config('wwwroot') . get_config('cleanurluserdefault') . '/' . $userurlid . '/'; $cleanurlbase = profile_url($USER) . '/';
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment