Topic: Users Online Integration

I would like to use the PunBB users online on my website pages as well as the forums. So if a visitor is just on my website it would add them as a guest online on the forums. I searched through the forums and found a page that said to add this code:

define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);

$PUN_ROOT = '../bb/';
@include $PUN_ROOT.'include/common.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
    exit('config.php doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

When I do that it tells me:

The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.

My directories are as follows:

/bb/ is where my PunBB is installed
/test/ is where I'm trying to use this script from

Any ideas what I'm doing wrong here?

Re: Users Online Integration

Why don't you use that extern.php file? That is much easier to use...

3 (edited by kurisu 2005-03-20 21:23)

Re: Users Online Integration

I am using the extern.php file to output the users online. But that doesn't add people that are just on the website, it only counts people that are on the forums.

Edit:

I also tried setting PUN_ROOT to the full server path but when I do that it says:

The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.

Re: Users Online Integration

http://punbb.org/docs/dev.html#integration

Re: Users Online Integration

Thank you that code is working perfectly. I must of been using code from an older version of PunBB.

Re: Users Online Integration

If I want guests visiting my site (but not in the forum) to display properly in "users online", I would have to make their visit count as a visit to the forum (and not a PUN_QUIET_VISIT). However, this means that members who visit the home page will also have this visit counted as a visit to the forum (since I have to declare PUN_QUIET_VISIT before I know if the visit is from a guest or member).

Is there any particular disadvantage to doing this, other than the fact that the member's "last visit to forum date" could well be incorrect?

Thanks for any help!

Re: Users Online Integration

yes, if a registered user visits the page but not the forum then topics they have not read will be marked as read

8 (edited by Patrick 2005-06-14 12:14)

Re: Users Online Integration

Ok, so that sounds like a bad idea. Is there any way then of declaring PUN_QUIET_VISIT and calling include/common.php, and then, if I find the visit is from a guest, count them somehow? (and so have members successfully having a quiet visit).