Profile URL v1.1

Release Notes

Fixed 404 when username contains a dot

  • This plugin has no interaction with the database and won't have any lasting effect if disabled.

  • Hey there,

    I installed this, but when I log in, I can't see where i am meant to set the custom profile URL?

    Does this have any conflicts with other plugins that you know of?

    I'm using 3 Column River Activity and Profile Manager that may conflict?

    Cheers,

    Leigh.

     

  • There is no place to 'set' a custom profile url.  This plugin defines it's own url template for user entities, it probably conflicts with any plugin that uses the 'route', 'profile' plugin hook.  Haven't tested with any other plugins.

  • Hi, your plugin work great..
    But I found a problem when try to share my Elgg profile on facebook. If I type the link www.mydomain.com/myusername facebook will only detect 1 picture and it is the default elgg profile picture. But if I type www.mydomain.com/profile/myusername, facebook can detect my custom elgg profile picture also another picture on my profile. Is it a bug or what?

  • @drafha - dunno, I don't actually recommend using this plugin to be honest

  • please update, This plugin has problems with symbols, example http://www.mysite.com/brianfløe

    this symbol is ø

  • @mariano Use this hook

    function seo_friendly_url_plugin_hook($hook, $entity_type, $returnvalue, $params) {
        $separator = "dash";
        $lowercase = TRUE;

        if ($entity_type == 'friendly:title') {
            $title = $params['title'];

            $title = strip_tags($title);
            $title = preg_replace("`\[.*\]`U","",$title);
            $title = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$title);
            
            $title = str_replace("&","and",$title);
            $title = htmlentities($title, ENT_COMPAT, 'utf-8');
            $title = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $title );
            $title = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $title);

            if ($lowercase === TRUE) {
                    $title = strtolower($title);
            }

            if($separator != 'dash') {
                    $title = preg_replace('-', '_', $title);
                $separator = '_';
            }

            else {
                    $separator = '-';
            }

            return trim($title, $separator);
        }

    }

     

    Adittional add

    $title = str_replace("YOUR_ANY_NEEDED_SYMBOL","FIX_IT_WITH",$title);

    Example

    $title = str_replace("ø","o",$title);

  • <?php /*****************TwizaNex Smart Community Software*************************** *

    * begin : Mon Mar 23 2011 * copyright : (C) 2011 TwizaNex Group * website : http://www.TwizaNex.com/ * This file is part of TwizaNex - Smart Community Software *

    * @package Twizanex * @link http://www.twizanex.com/

    * TwizaNex is free software. This work is licensed under a GNU Public License version 2.

     * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

    * @author Tom Ondiba <twizanex@yahoo.com> * @copyright Twizanex Group 2011

    * TwizaNex is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;

     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    * See the GNU Public License version 2 for more details.

    * For any questions or suggestion write to write to twizanex@yahoo.com

    * credits: http://biostall.com/php-benchmark-multiple-str_replace-vs-one-with-array ***************************************************************************/

    # ## Conclusion

    ## In both scripts bellow, we are doing a single call to str_replace() and many str_replace().

    ##The str_replace() is somewhat quicker or faster than doing lots of str_replace(); calls.

    ## The str_replace(); can be become handy tool or time savings. The savings are quite small but can Add ## up when browsing a profile or replacing accents or characters that are potentially thousands of times a ## day. Here is the results you will get after running this script: The Time it Took to find and replace single ## str_replace() in microseconds 14.499215841293 microseconds The Time it Took to find and replace

    ## arrays in microseconds12.582410812378 microseconds //twizanex string contains a very long or many ## replacements words.

    $twizanex = str_repeat("By Matt Beckett: Profile URL for Elgg 1.8. Yet another plugin to make the profile url into the form of base_url/username. Prevents new users from registering with a conflicting username. No magickal frameworks necessary! Only 35 lines of code, including whitespace and comments!! ", 100);

    ## Using short string with one str_replace() at a time

    $startTime = microtime(true); for ($i=0; $i<10000; $i++) { $title = $twizanex; $title = str_replace("Matt", "tom", $title); $title = str_replace("Beckett", "ondiba", $title); $title = str_replace("likes", "unlikes", $title); $title = str_replace("Profile", "people", $title); $title = str_replace("Yet", "knows", $title); $title = str_replace("plugin", "column", $title); $title = str_replace("another", "facebook", $title); $title = str_replace("username", "whitespace", $title); $title = str_replace("URL", "Her", $title); $title = str_replace("Prevents", "bookmarks", $title); $title = str_replace(" is ", " she ", $title); $title = str_replace("1.8", "35", $title); $title = str_replace("registering", "Chinese", $title); $title = str_replace("conflicting", "recommendations", $title); $title = str_replace("magickal", "alphabet", $title); $title = str_replace("frameworks", "internationalization", $title); $title = str_replace("necessary", "domainnames", $title); $title = str_replace("including", "normally", $title); $title = str_replace("No ", "Yes ", $title); $title = str_replace("comments", "representation", $title); } $endTime = microtime(true); echo "The Time it Took to find and replace single str_replace() in microseconds ".($endTime - $startTime)." microseconds";

    ## Using arrays with one str_replace() in single line

    $find = array("Matt", "Beckett", "likes", "Profile", "Yet", "plugin", "another", "username", "URL", "Prevents", " is ", "1.8", "registering", "hobbies", "magickal", "frameworks", "necessary", "including", "No ", "comments"); $replace = array("tom", "ondiba", "unlikes", "people", "knows", "column", "facebook", "whitespace", "Her", "bookmarks", " she ", "35", "Chinese", "recommendations", "alphabet", "internationalization", "domainnames", "normally", "Yes", "excited");

    $startTime = microtime(true); for ($i=0; $i<10000; $i++) {

    $title = $twizanex; $title = str_replace($find, $replace, $title);

     } $endTime = microtime(true);

    echo "\nThe Time it Took to find and replace arrays in microseconds".($endTime - $startTime)." microseconds";

    echo $title;

    ?>

     

    <?php 

    /*

    @ RvR , I agree with Mr.  Matt Beckett . "I don't actually recommend using this plugin to be honest."

    Copy the above script and run it on your browser or testing server. The result will be astonishing.

    The main point is, be careful when using str_replace(); it can take a very very long time if you use it with long replacement character or words

    I hope this helps someone in need...

     */

    ?>

  • Nice plugin..

    Works perfect.

    But for all newbies, I have a nature to name my admin account username as admin. If we make admin account username as admin, we never get site admin dashboard. :-)

    Because after plugin instalation, elgg believe that we ask for admin profile. :-) Elgg administration url is http://elgg/admin.

  • correct, that is why I repeatedly tell people not to use this plugin.

    I still leave it here because people obviously want to do this anyway, but I don't see any value in avoiding the profile pagehandler

  • @Matt Beckett

    Never leave it Matt. The idea is great. Community members can get one more strong identity based on there community in internet. :-) All people like this.

    I know you are busy and still developing and upgrading too meny plugins for elgg community. I am a perfect newbie with 10 days old at here. I don't know any thing about code or development. So If you can get time, upgrade it. It is a better plugin for us.

  • @Matt

    Just a question would there be a way to change this plugin so that it changes the address for groupss, current: [domain]/groups/profile/00/[Group Name] to [domain]/groups/[Group Name]. Which will make it the same as the way the current profile link is.

    Having things in the /profiles /groups or what have you does make things a lot easier for your users as well as admins so things don't conflict.

  • No, because group names are not unique.

  • @Matt There must be a way to make it so that they are unique as the current address layout is to bulky and hard to remember.

    As a newcomer I have no clue where to start with that.

  • Would it be possible to get this working with the private profiles plugin?

    https://community.elgg.org/plugins/1860995

     

    thanks

  • A question and suggestion, that might help reduce or eliminate problems with "conflicting usernames?

    Might using a URL "schema" that adds "pagehandler." prior to the domain name, and "/username" after the domain name, help solve this problem?

    ex. "pagehandler.domainname.com/username&quot;

    profile.elgg.org/username; blog.elgg.org/username; groups.elgg.org/username, pages.elgg.org/username,&nbsp;

    Your thoughts? 

     

  • @Tom - what you are describing is not a pagehandler, it's a subdomain a plugin can't programmatically do anything with it.

Matt Beckett

I'm a self-employed web developer, family man, nerd, scuba diver. Manager/maintainer of this elgg community site, and core Elgg development team member.

Stats

  • Category: User admin
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-27
  • Downloads: 2900
  • Recommendations: 23

Other Projects

View Matt Beckett's plugins