PDA

View Full Version : phpBB Member Bar



Darthvadersmaster
March 1st, 2006, 12:31
Okay, I've searched and searched, and searched some more through 3-4 phpBB mod/hacks sites, and found NOTHING that can display visitor's forum information on your normal web pages (like the SDK for IPB). Basically I'd like to display visitor's:
-Visitor's Username
-New PM's and total PM's (2/13)
-Visitor's Cash
-A logout text
-Possibly current avatar

I've requested this at sites too, no luck *sigh*

So help would be appreciated :D

Richard
March 1st, 2006, 13:18
Just include the main file. You can get the information using the php types, like: $userdata['email']

Let me take a look to see what you need to include. Will edit in a sec

EDIT: You need to include this code in the page:


define('IN_PHPBB', true);
$phpbb_root_path = './'; //Path the phpbb index.php/comming.php
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');

Darthvadersmaster
March 1st, 2006, 17:33
Okay, and just find the things, like you said ($userdata)?

Richard
March 2nd, 2006, 05:03
I think that its:

$userdata['username'];
$userdata['email'];

ect.

DarkBlood
March 2nd, 2006, 14:19
You're also going to need the MySQL functions for phpBB. IPB has its own MySQL functions but does not use PHP's default functions (like mysql_query, etc.)

As IPB does it, the avatar is parsed differently in the Board.php than it is on the Member ViewProfile page, and I assume phpBB does the same...


<?php

$member = new Array();

$member[] = mysql_query('SELECT * FROM `phpbb_members` WHERE id=`'.$this_id.'`');

$currentavy = $member['avatar'];

I'm not going into more because PHP is much easier than people allow it to be.

Darthvadersmaster
March 2nd, 2006, 17:29
Okay, somebody worked this code out for me...

define('IN_PHPBB', true);
$phpbb_root_path = './forums/'; // change this to your forums' directory
include_once($phpbb_root_path . 'extension.inc');
include_once($phpbb_root_path . 'common.'.$phpEx);

// Start session management

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

if($userdata['session_logged_in']) { // if logged in
// print out username:
echo $userdata['username'];
// print out number of new private message
echo $userdata['user_new_privmsg'];
// print out $userdata array to find what else it has:
print_r($userdata);

}
else{ // not logged in
;;
}

And I get this error:

Hacking attempt
Fatal error: Call to undefined function: session_pagestart() in /home/neobpal/public_html/starwars/index.php on line 65

DarkBlood
March 3rd, 2006, 09:37
Call to undefined function: session_pagestart()

means that the function does not exist.

Darthvadersmaster
March 3rd, 2006, 11:35
Ah, thank you.

What should I do about the 'Hacking attempt' thing?

Richard
March 3rd, 2006, 11:43
What version of phpBB are you using?

DarkBlood
March 3rd, 2006, 12:07
Hacking attempt is phpBB's way of saying why the error occured. IPB doesn't do it when this happens (Nor does vB, etc.)

Darthvadersmaster
March 3rd, 2006, 12:15
Uh, the latest one.

2.0.19 I think