Topic: Integrating punBB 1.3 - definitive guide

Morning all!

Don't bite my head off, but this needs to be done. I am new to punBB and finding my way around it really well, except for, that is, integration information.
Other than some basic info available here and there on the forum, (most of which relating to 1.2 so does not necessarilly work with 1.3) and otherwise the wiki still seems very underdeveloped.

The guys at punBB are doing an incredible job, but I thought a thread with sample code would be very helpfull to me, but also then to others.

So, these are the things I would like to be able to do:

1. Basics: I understand that for anything to work the following needs to be included at the top of every page you are looking to integrate with the forum:
<?PHP
define('FORUM_ROOT', './forum/');
require FORUM_ROOT.'include/common.php';
?>

where "forum" is replaced with the folder where the forum files are kept in your web root.


2. Have a log in box on all pages of the site (including non-forum pages) and be able to display the login box if not logged in, or a "Welcome ???!" if you are logged in.
I managed to display the welcome message by doing this:
Hello <?php echo forum_htmlencode($pun_user['username']); ?>!

But am not sure of how to check if the person is logged in or not. Any help?
Not sure also how to replicate the login fields from the forum login to put in the login box on every page. Any help?

3. Registration page. The forum has it's own page, but how easy is it to replicate that form on a page of our own if we want to ask users additional questions. Any help here appreciated.

Any other integration hints, tips etc.. for punBB 1.3 would be great.

Good luck all and look forward to hearing from you with your advice, etc..

Many thanks,
Duncan

Re: Integrating punBB 1.3 - definitive guide

example.php

<?PHP
define('FORUM_ROOT', 'forum/');
require FORUM_ROOT.'include/common.php';

if ($forum_user['is_guest']) {    // Guest user
    echo 'You are not logged in. Please <a href="forum/login.php">login</a> or <a href="forum/register.php">register</a>.';
        }
        
else {
    echo forum_htmlencode($forum_user['username']).'<br>'; // Username
        echo $forum_user['id'].'<br>';                        // User ID
        echo generate_form_token('logout'.$forum_user['id']).'<br>'; // User logout token
        
        echo '<a href="forum/login.php?action=out&id='.$forum_user['id'].'&csrf_token='.generate_form_token('logout'.$forum_user['id']).'">Logout</a>'; // Logout link
        }

echo '<br><br><a href="forum/viewtopic.php?id=1">Back</a>';
?>

Re: Integrating punBB 1.3 - definitive guide

very useful.
i've wanted to integrate a page for a while now with the downloads...
that kind of info is very handy. will go and have a go at it...
thx.