1
tcendros
How i can get the username var, I must declarate the var or what?
  • 2008/10/15 13:38

  • tcendros

  • Just popping in

  • Posts: 15

  • Since: 2008/10/10


I have not get a username. How ca I get thi var? I have this code.
include("../../mainfile.php");
global $xoopsUser ;
global $xoopsDB ;
echo $xoopsDB;
echo $username;
echo $xoopsUser ;
I not return anything var.
Wy need, I supous that i need declarate a global var. But how can declarate this var or how I need for get the username var? THANKS YOU!!!

2
iHackCode
Re: How i can get the username var, I must declarate the var or what?

maybe something like.

//make sure this is correct location to mainfile.
include("../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

if (
is_object($xoopsUser)) {
$stuff 'hello: '.$xoopsUser->uname();
}

$xoopsTpl->assign('xoops_contents',$stuff);
include(
XOOPS_ROOT_PATH."/footer.php");
?>

http://dev.xoofoo.org/xoopsphpxref/20181/nav.html?htdocs/kernel/user.php.html
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

3
tcendros
Re: How i can get the username var, I must declarate the var or what?
  • 2008/10/15 19:19

  • tcendros

  • Just popping in

  • Posts: 15

  • Since: 2008/10/10


Dont work, may be i need other file configuration for take a username var? can you show me a sample for get a username in a var? Is very Important, I need for a begin a project, or take anothwer way.

4
tcendros
Re: How i can get the username var, I must declarate the var or what?
  • 2008/10/15 19:42

  • tcendros

  • Just popping in

  • Posts: 15

  • Since: 2008/10/10


I have a solution:

echo $xoopsUser->uname();
Show the login name, bufffff Im alive, fo the moment, still have a long work untell will have a intranet working.
By the way sorry for my english is poor or not is a ????? jajaja.

5
tcendros
Re: How i can get the username var, I must declarate the var or what?
  • 2008/10/15 19:50

  • tcendros

  • Just popping in

  • Posts: 15

  • Since: 2008/10/10


I have another question:
I wana that if the user are login, can work ok, but also wana that the user haven login in the system the program show a login screen. How I get it?

Thanks again.

6
iHackCode
Re: How i can get the username var, I must declarate the var or what?

add an else so that when they are not a user they are redirected to the login screen.?

include("../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

if (
is_object($xoopsUser)) {
   echo 
$xoopsUser->uname();
}else{
    
redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
    exit();
}


include(
XOOPS_ROOT_PATH."/footer.php");
?>


you can change _NOPERM to "Some Kind Of Message"
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

Login

Who's Online

298 user(s) are online (233 user(s) are browsing Support Forums)


Members: 0


Guests: 298


more...

Donat-O-Meter

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

Latest GitHub Commits