Forums | Mahara Community

Support /
Automatically regenerate clearnuls


Mario Gharib's profile picture
Posts: 26

17 December 2015, 23:19

Dear maharares

I configured our mahara website in order to support cleanurls,

The problem is that I have to click on the "Regenerate cleanurls" button everytime a new user logged in from using the SSO integration with moodle.

Is there a way to make regenerate cleanurls automatically.

Your assistance would be a great beenfit

Mario Gharib.

-----------------------------------------------------------------------------------------------------

File: httpd.conf for apache

<Directory "/var/www/html/mahara">
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule ^user/([a-z0-9-]+)/?$ /user/view.php?profile=$1&%{QUERY_STRING}
RewriteRule ^user/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?profile=$1&page=$2&%{QUERY_STRING} 
RewriteRule ^/group/([a-z0-9-]+)/?$ /group/view.php?homepage=$1&%{QUERY_STRING}
RewriteRule ^/group/([a-z0-9-]+)/([a-z0-9-]+)/?$ /view/view.php?homepage=$1&page=$2&%{QUERY_STRING}

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
^(.*)$ https : // mahara .usj. edu. lb/$1 [R,L]

</IfModule>
</Directory>

 

File config.php for mahara

$cfg->wwwroot='https : // mahara. usj. edu. lb/';
$cfg->cleanurls=true;

Aaron Wells's profile picture
Posts: 896

18 December 2015, 15:20

Hi Mario,

What happens if you don't click "Regenerate cleanurls"? Does the user's profile fail to generate a cleanurl?

How about if you manually generate a test user, who is using the internal authentication? Does their profile URL get set up correctly?

Also, what version of Mahara are you using?

Mahara tries to generate a unique profile clean URL when the user is created, no matter what authentication method they're created by. It is possible there's a bug in the code that handles it for the xmlrpc plugin, but I took a look at it just now and everything looks fine there as far as I can tell.

Cheers,

Aaron

Mario Gharib's profile picture
Posts: 26

07 January 2016, 21:33

Yeah the user's profile fail to generate a cleanurl if I don't click "regenerate cleanurls"

So I have to manually click "regenerate cleanurls" every time a new user is added.

I am using the Mahara version: 15.04.3

Kristina Hoeppner's profile picture
Posts: 4859

08 January 2016, 8:29

Hello Mario,

This is very unusual and does not happen normally on Mahara. The "regenerate cleanurls" button should only be used in rare cases because it would revert all URLs that users have already set themselves to the standard ones for their pages and groups.

For example, the new page "My portfolio for 2016" would receive the automatic clean URL "my-portfolio-for-2016". The user might not like that URL though and changes it to "portfolio-2016". When you click the regenerate button, the URL reverts back to "my-portfolio-for-2016" and any links that the user has set to his custom URL are broken.

On what sort of hosting are you? The wiki page provides two different instructions: One for Apache and one that also requires an htaccess file.

Upgrading to the latest stable release in the Mahara 15.04 series shouldn't make a difference but is highly recommended to ensure you have the latest security patches installed.

Cheers

Kristina

 

Mario Gharib's profile picture
Posts: 26

12 January 2016, 1:58

Dear Kristina,

I want to thank you for your detailed and useful reply,

I want to inform you that I discovered recently that there was no problem with regenerating cleanurls from the first beginning. The problem is that it was regenerating clearnurls using username instead of real names (We are using LDAP server) !!!

For example:

My username is 712299, so when I log in on mahara, the cleanurl will be:

http:// mahara.usj.edu. lb/user/ 712299

And not http:// mahara.usj.edu. lb/user/mario-gharib

So because of this, I have to press the button (regenerate urls), so that the url contains my real name and not my username (digital numbers)

Note that, I also set the system to (Never display usernames) in the site options.

Do you know why it is using my username instead of my real name? Is there a way to let regenerating cleanurls to use real names instead of usernames ?

Many thanks.

Mario

Kristina Hoeppner's profile picture
Posts: 4859

12 January 2016, 8:33

Hello Mario,

Per default, the clean URLs are generated using the Mahara username as identifier and not the first or last or displayname. See the wiki. I'm sure there is a way of changing that to first and last name, but I'm afraid I don't know how.

Cheers

Kristina

 

Mario Gharib's profile picture
Posts: 26

14 January 2016, 2:00

Dear Kristin,

Thanks again for your assistant,

Concerning generating clean urls using displayname (first&Last name) instead of username,

I wrote the following sql code in order to update the field urlid 

UPDATE usr
SET urlid=REPLACE(split_part(email,'@',1), '.', '-');

This code should be triggered every time a new user is added to the database

Have a blessed time,

Mario

Aaron Wells's profile picture
Posts: 896

15 January 2016, 14:05

Hi Mario,

It turns out this behavior is due to a bug in Mahara. I've posted some more information about it on your other thread: https://mahara.org/interaction/forum/topic.php?id=7493

Cheers,
Aaron

8 results