31
antifmradio
Re: username as uid ?

bump
see here for working code


https://xoops.org/modules/newbb/viewtopic.php?post_id=287355#forumpost287355

32
belia
Re: username as uid ? (Yogurt Social Network)
  • 2010/1/2 3:58

  • belia

  • Just popping in

  • Posts: 83

  • Since: 2007/12/18


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 onehttp://mydomain.com/modules/profile/userinfo.php?uid=82 and not stay ashttp://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/profile/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 ?

Login

Who's Online

185 user(s) are online (85 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits