X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Display a users first name instead of the login in authbox (https://forum.x-cart.com/showthread.php?t=2717)

jaymon 05-15-2003 10:57 AM

Display a users first name instead of the login in authbox
 
After a user logs on to my site, I'd rather the authbox.tpl display their first name instead of the default username or login name. I've noticed it calls /include/login.php and that it pulls the login name from the database with other user data and displays it in authbox.tpl with the variable {$login}. How would I call the users firstname into the template instead of the login name?

TIA,
jaymon

funkydunk 05-16-2003 11:15 PM

try {$userinfo.firstname} instead of {$login}

:D

jaymon 05-19-2003 06:46 AM

Quote:

Originally Posted by funkydunk
try {$userinfo.firstname} instead of {$login}

:D


funkydunk, thanks for the reply.

Hmmm, I tried that with no success. Not sure if it matters, but I'm using X-cart version 3.3.3.

I see the authbox.tpl template is calling /include/login.php and in it there's a call to the database that grabs the user data.

$user_data=func_query_first("select * from $sql_tbl[customers] where login='$username' and usertype='$usertype' and status='Y'");

and below that I assume this is putting the user data from the database into login

$login = $user_data[login]; //$username;

I assume that I need to pull the customers firstname from the database also, because it doesn't look like it's being done above. And then I can build a variable like the login above. I this a correct assumption? Sorry, I'm not a PHP wizard.

TIA,
jaymon

Jon 05-29-2003 02:24 PM

In my /include/check_useraccount.php

I added the query:

Code:

$name=func_query_first("select firstname,lastname from $sql_tbl[customers] where login='$login'");

In the same file:

Code:

$smarty->assign("name",$name);$smarty->assign("name",$name);

Then in my authbox.tpl

Code:

Welcome back,
{$name[0]} {$name[1]}


jaymon 05-30-2003 07:09 AM

Quote:

Originally Posted by Jon
In my /include/check_useraccount.php

I added the query:

Code:

$name=func_query_first("select firstname,lastname from $sql_tbl[customers] where login='$login'");

In the same file:

Code:

$smarty->assign("name",$name);$smarty->assign("name",$name);

Then in my authbox.tpl

Code:

Welcome back,
{$name[0]} {$name[1]}



This works! Thanks a lot for the help Jon. :D

Jon 05-30-2003 07:11 AM

Your welcome :D

luizgg 08-18-2003 02:25 PM

Hello,

Have applied both soluitons to my authbox.tpl template, but firstname is actually shown on all pages except for home.php.
What should I try?

Jon 08-18-2003 02:30 PM

Can you explain what you've done and/or provide a URL to your site?

luizgg 08-20-2003 05:45 AM

I've used {$userinfo.firstname} instead of {$login}

test site URL : http://ad.atrativagames.com.br/loja

Jon 08-20-2003 09:51 AM

That won't work.

If you follow the instructions I posted above, it should.

luizgg 08-21-2003 06:09 AM

Other mehtod haven't worked also...
Where on the file should I put the code you've described?


All times are GMT -8. The time now is 01:46 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.