xoops forums

jorge

Just popping in
Posted on: 2008/1/16 10:11
jorge
jorge (Show more)
Just popping in
Posts: 23
Since: 2004/5/17
#1

Controlling members out of XOOPS

I have a XOOPS based site (2.0.13 version) and I would like to continue controlling the members in another part of the site.

The new code is written in PHP as well. I've been trying thinks like that:

include "XXX/mainfile.php";
include "XXX/include/common.php";
$uid = $xoopsUser->getVar('uid');


What collection of functions do I have to call to take control of the user session in XOOPS?

Kind regards, thanks in advance,

Jorge

nachenko

Quite a regular
Posted on: 2008/1/16 10:26
nachenko
nachenko (Show more)
Quite a regular
Posts: 356
Since: 2005/1/18
#2

Re: Controlling members out of XOOPS

You need mainfile to get XOOPS config, and header.php to get the $xoopsUser object and session control

jorge

Just popping in
Posted on: 2008/1/16 11:03
jorge
jorge (Show more)
Just popping in
Posts: 23
Since: 2004/5/17
#3

Re: Controlling members out of XOOPS

Thanks for your help nachenko,


I've write:

include "XXX/mainfile.php";
include "XXX/header.php";

if ($xoopsUser) {echo "Sí";} else {echo "No";};


The response is always "No".

What can I prove?

nachenko

Quite a regular
Posted on: 2008/1/16 11:31
nachenko
nachenko (Show more)
Quite a regular
Posts: 356
Since: 2005/1/18
#4

Re: Controlling members out of XOOPS

try evaluating user this way:

if (is_object($xoopsUser))

This is taken form a real website:

Quote:
if (!is_object($xoopsUser)) {
redirect_header('javascript: history.back(1);', 3, _NOPERM);
}


You can see it in action clicking on this link:

http://www.sinestesia2007.info/forms/congress_form.php

then try login as test / test and try again.

jorge

Just popping in
Posted on: 2008/1/16 15:59
jorge
jorge (Show more)
Just popping in
Posts: 23
Since: 2004/5/17
#5

Re: Controlling members out of XOOPS

Congratulations for your work nachenko,

I've test your web and it's Ok, but I can't access to the xoopsUser object.

Are you sure you only include mainfile and header? Do you make something else?

Best regards!
Jorge