xoops forums

antifmradio

Just can't stay away
Posted on: 2008/10/16 23:25
antifmradio
antifmradio (Show more)
Just can't stay away
Posts: 457
Since: 2007/8/15
#31

Re: username as uid ?

bump
see here for working code


https://xoops.org/modules/newbb/viewto ... id=287355#forumpost287355

belia

Just popping in
Posted on: 2010/1/2 3:58
belia
belia (Show more)
Just popping in
Posts: 83
Since: 2007/12/18
#32

Re: username as uid ? (Yogurt Social Network)

Quote:

ericktot wrote:
I found the code, sarahmx try...


create username.php in XOOPS root

Quote:

<?php

require_once "mainfile.php";

unset($uname);
if (isset($_GET['uname'])) $uname = $_GET['uname'];

if (isset($uname)) {
$member_handler =& xoops_gethandler('member');
$criteria = new Criteria("uname", $uname);
if ($member_handler->getUserCount($criteria) == 1) {
$user_list =& $member_handler->getUsers($criteria);
list($user) = $user_list;
header('Location: '.XOOPS_URL.'/modules/yogurt/index.php?uid=' . $user->uid()); exit ();
} else {
header('Location: '.XOOPS_URL.'/user.php'); exit ();
}

}

?>



In .htaccess in XOOPS root

Quote:

RewriteEngine On
RewriteRule ^([A-Za-z_0-9-]+)((/)|())?$ http://yourdomain.com/username.php?uname=$1


working for me =)


i changed the line..cause im using the profile module

header('Location: '.XOOPS_URL.'/modules/yogurt/index.php?uid=' $user->uid()); exit ();


to

header('Location: '.XOOPS_URL.'/modules/profile/userinfo.php?uid=' $user->uid()); exit ();


this is working

type

http://yourdomain.com/username.php?uname=belia

and it redirects to my profile info but the url in address bar change to the normal one http://mydomain.com/modules/profile/userinfo.php?uid=82 and not stay as http://yourdomain.com/username.php?uname=belia

i found a XOOPS site


http://www.redhotchilipeppers.lt/rhcp/

take a look at this

the username of the user is zygimantas and uid is 1384
http://www.redhotchilipeppers.lt/rhcp/profile/1384/zygimantas


the original url is

http://www.redhotchilipeppers.lt/rhcp ... ile/userinfo.php?uid=1384


the site seems manage to to do this username in url for profile


anyone know how to do somelike in the site above ?