21
wishcraft
Re: username as uid ?

Hi krew,

it is pretty straight forward to introduce features like that but you have to be an intermediate PHP programmer I would say.

What you need to do..

ie: to edit a file such as userinfo.php so you have,http://www.yoursite.com/Username for there profile.

is introduce a new $_GET['username'] into the script with some SQL to find the UID of $_GET['username']

ie. select uid from _prefix_users where uname = $_GET['username'];

if you have a uid then you can call the rest of the script make the following change to the .htaccess file in your root.

Quote:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\ \'\_]+)$ userinfo.php?username=$1 [L,NC,QSA]
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

22
sarahmx
Re: username as uid ?
  • 2008/4/20 10:40

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


Quote:

Trabis wrote:
http://www.xuups.com/modules/wfdownlo ... inglefile.php?cid=6&lid=1

i'm using the default XOOPS profile
i've tested this in localhost(xampp)

using this urlhttp://localhost/xoops/users/admin/
i received the object not found message..

while this one is working
http://localhost/xoops/users/index.php?uname=admin

will test this in real server later

Quote:

wishcraft wrote:
e: to edit a file such as userinfo.php so you have,http://www.yoursite.com/Username for there profile.

is introduce a new $_GET['username'] into the script with some SQL to find the UID of $_GET['username']



wishcraft,

can you explain..step by step ? it will be great if you provide a download package like trabis

23
wishcraft
Re: username as uid ?

Quote:


wishcraft,

can you explain..step by step ? it will be great if you provide a download package like trabis



Well if you have the .htaccess in the /XOOPS_ROOT_PATH/.htaccess

And the .htaccess for that is

Quote:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^users/([a-zA-Z0-9\ \'\_]+)/$ users/index.php?uname=$1 [L,NC,QSA]
RewriteRule ^users/([a-zA-Z0-9\ \'\_]+)$ users/index.php?uname=$1 [L,NC,QSA]
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

24
trabis
Re: username as uid ?
  • 2008/4/20 13:29

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

using this urlhttp://localhost/xoops/users/admin/
i received the object not found message..


http://localhost/xoops/users/admin should work, I did not count with the last traling slash, that way it will be looking for uname = 'admin/'.

25
sarahmx
Re: username as uid ?
  • 2008/4/21 7:56

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


i did not understand this part..i'm not a programmer

Quote:
is introduce a new $_GET['username'] into the script with some SQL to find the UID of $_GET['username']

ie. select uid from _prefix_users where uname = $_GET['username'];

if you have a uid then you can call the rest of the script make the following change to the .htaccess file in your root.




http://localhost/xoops/users/admin/ or
http://localhost/xoops/users/admin does not work

but this one is working

http://localhost/xoops/users/index.php?uname=admin

26
sarahmx
Re: username as uid ?
  • 2008/4/21 7:56

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


have anyone else tried ? does it work for you guys ?

27
trabis
Re: username as uid ?
  • 2008/4/21 12:38

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

sarahmx wrote:
have anyone else tried ? does it work for you guys ?


Probably you do not have mod_rewrite enable. :(

28
ericktot
Re: username as uid ? (Yogurt Social Network)
  • 2008/5/17 1:08

  • ericktot

  • Just popping in

  • Posts: 6

  • Since: 2003/2/21


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

29
sarahmx
Re: username as uid ?
  • 2008/7/27 8:55

  • sarahmx

  • Quite a regular

  • Posts: 381

  • Since: 2007/10/28


will try again this later

30
antifmradio
Re: username as uid ?

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

Login

Who's Online

137 user(s) are online (89 user(s) are browsing Support Forums)


Members: 0


Guests: 137


more...

Donat-O-Meter

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

Latest GitHub Commits