Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 + 9 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: username as uid ? (Yogurt Social Network)
by belia on 2010/1/2 3:58:19

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

le="color: #000000"><?php header('Location: '.XOOPS_URL.'/modules/yogurt/index.php?uid=' . $user->uid()); exit ();


to

le="color: #000000"><?php 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/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 ?
Re: username as uid ?
by antifmradio on 2008/10/16 23:25:35

bump
see here for working code


https://xoops.org/modules/newbb/viewtopic.php?post_id=287355#forumpost287355
Re: username as uid ?
by antifmradio on 2008/7/27 19:48:32

sory to say but you guys are getting this all wrong

the code above that some of you are having trouble with is called a
REWRITE RULE

this will take a URL that you goto and REWRITE it on the browser to something else

if that something ELSE doesnt exist in your domain, then it wont work


most of you are actually trying to use

REDIRECT Rule

i posted this in another thread for everyone to use
Look for REDIRECT RULE
Re: username as uid ?
by sarahmx on 2008/7/27 8:55:35

will try again this later
Re: username as uid ? (Yogurt Social Network)
by ericktot on 2008/5/17 1:08:01

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 =)

Who's Online

208 user(s) are online (168 user(s) are browsing Support Forums)


Members: 0


Guests: 208


more...

Donat-O-Meter

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

Latest GitHub Commits