Howto change url profile ?

Hello,

I would like to work with another URL than the default url.
For example, I want to use http://community.elgg.org/pg/profile/guid_Christophe_Milhau instead of http://community.elgg.org/pg/profile/Christophe (same spirit than Facebook because I want to work with first name, last name, e-mail for registration and not with username)

Can you tel me if there's a plugin about this, or if someone work on it ?

Thank's !
Christophe

 

  • Hi Christophe,

    Are you sure that embedding display names that may contain non-ASCII characters in a URL will work properly?

    If so, then isn't one option to simply change the registration process to set the username to the display name (or some URL-friendly version of it), possibly with the guid prepended? That way you would not need to change the URL generation at all.

  • Hi Kevin,

    you're right, the url must have good caracters, but I don't thing the trouble is here (just have to create a good url with filtering caracters, I have this on one of my website). The trouble is how to know, where I have to change the informations correctly to keep elgg working correctly.

    Thank's for your answer.

    Christophe

  • I think that this could be done with a very simple plugin.

    The plugin would over-ride the register action like so:

    register_action("register", true, $CONFIG->pluginspath . "myplugin/actions/register.php");

    You would then take the actions/register.php file and copy it into

    mod/myplugin/actions/register.php

    You can then change the line near the top:

    $username = get_input('username');

    to autogenerate the username.

    If you want the username to actually contain the guid, that is a problem, but you could do that by setting the username temporaily to a timestamp followed by say ten random characters and then reset it to what you want once the user has been created and you know the guid.

    You would also need to over-ride the register view to remove the username.

    And the login form and action to allow people to login using their email address.

     

     

  • I started my plugin and it's now possible to change the username.

    But I want to insert the guid now.

    I can create the new username but I cant save the new value. Can you telle me where is the trouble ?

    My code :

     $new_username = $guid.'_'.$username;
     $new_user->username = $new_username;
     $new_user->language = 'fr';
     $new_user->save();

    Can you tell me if save() is right ?

    Thanks,
    Christophe