1
earplane
Localhost problem
  • 2006/3/17 11:01

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


Hi,

How come this prints nothing on my localhost setup, but it works OK when I upload it to the server? The rest of my XOOPS setup works OK at home.

$user = new XoopsUser($someID);
$userName $user->uname();
echo 
$userName;

2
earplane
Re: Localhost problem
  • 2006/3/20 21:23

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


Repeat: could anyone sum up exactly what is needed to make the above snippet work in a module (includes, global declarations and so on)?

I'd really like to be able to work offline in Eclipse, but right now I'm back to ftp'ing files every couple of minutes.

3
Dave_L
Re: Localhost problem
  • 2006/3/20 21:41

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


1) The code you posted doesn't make sense (to me). What is its purpose?

2) Do you have PHP debug enabled?

3) Which XOOPS version are you using?

4) I think that the uname method is deprecated, and that you should be using getVar('uname') instead.

4
earplane
Re: Localhost problem
  • 2006/3/21 15:55

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


Quote:
1) The code you posted doesn't make sense (to me). What is its purpose?

1. I've got the userid (integer) of an excisting user. I want to get this user's username. If this isn't how I should do it then blame it on the docs, but it works...:o)

Quote:
2) Do you have PHP debug enabled?

Yes. The only warnings relating to this module is irrelevant.

Quote:
3) Which XOOPS version are you using?

Both setups are 2.2.3. I've had very few problems with the site (after the initial problems), and I haven't gone back to 2.0.

Quote:
4) I think that the uname method is deprecated, and that you should be using getVar('uname') instead.

I tried replacing uname() with getVar('uname') and it works perfectly online, but the problem's still there on localhost.

Thank you for replying. Have you got a clue?

5
Dave_L
Re: Localhost problem
  • 2006/3/21 16:13

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I can't think of a reason why it would work on a remote server and not on localhost.

But here's how I would do that:

// Given user ID $uid, get username $uname.
$member_handler =& xoops_gethandler('member');
$user           =& $member_handler->getUser($uid);
$uname          =  $user->getVar('uname');


The file kernel/member.php defines the getUser method, as well as other related methods. For example, getUserList is more efficient if you need to get the usernames of multiple users.

I'm using XOOPS 2.2.4, but this should be applicable to XOOPS 2.x in general.

6
earplane
Re: Localhost problem
  • 2006/3/21 19:31

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


To be sure the filesets were identical I downloaded them from server and yes, the problem's still there. The next step would be to do the same with the database, but I doubt if that will make a difference. So I've got two suggestions:

1. Could some setting in php.ini be different? Maybe in combination with...

2. Would there be a setting in my xoops_version.php files that could trigger this problem?


Any thoughts welcome

7
Dave_L
Re: Localhost problem
  • 2006/3/21 21:28

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Are there any other symptoms? Does every other feature of XOOPS behave identically on the remote server and on localhost?

I would add some debug code (print stuff out) to try to isolate the problem:

// Given user ID $uid, get username $uname.
$member_handler =& xoops_gethandler('member');
var_dump('member_handler'$member_handler);#*#DEBUG#
$user           =& $member_handler->getUser($uid);
var_dump('user'$user);#*#DEBUG#
$uname          =  $user->getVar('uname');
var_dump('uname'$uname);#*#DEBUG#

8
earplane
Re: Localhost problem
  • 2006/3/22 12:28

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


OK, I've found out that things stop working when I make a call to a database other than the main XOOPS base (my site uses two databases). I tried placing mysql_close after each call, but it didn't help.

How do I reconnect to the XOOPS database after making a call to another one?

Or maybe: how should I set up my local MySQL to deal with this?

9
m0nty
Re: Localhost problem
  • 2006/3/22 13:53

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


not sure what you're doing. you mean your 1 XOOPS site is trying to use 2 seperate databases? you'll need to explain more clearly on exactly what you are trying to do.

10
earplane
Re: Localhost problem
  • 2006/3/22 15:55

  • earplane

  • Just popping in

  • Posts: 35

  • Since: 2002/10/1


www.earplane.com

All shockwave-generated data is stored in a separate database, and results are stored with XOOPS userIDs. I want to get usernames from the XOOPS db after getting IDs from the other db.

Everything works online, but I can't get it to work on my offline localhost. And I don't like developing in public, I'm not that good...

Login

Username:
Password:

Lost Password? Register now!

Who's Online

59 user(s) are online (32 user(s) are browsing Support Forums)


Members: 0


Guests: 59


more...

Donat-O-Meter

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

Latest GitHub Commits