Would the following code which i put in the login page of the website get the user logged in into the forum? (can't try it out right now)
Would this be a method that works?

 
    include "./punbb/include/functions.php"; //Make sure the following code has access to the pun_hash() and pun_setcookie() function definitions
    
    $username = $user->Username;  //Get the username of the logged in user and put it in a variable    
    
    $queryFromPunbb = "SELECT * FROM punbb_users WHERE username='$username'";    //get the id from the logged in user. This id is the primary key of the punbb_users table in the punbb database
    $result = mysql_query($queryFromPunbb, $conn) or die (mysql_error());    //Run the query
    $row = mysql_fetch_array($result) or die(mysql_error());    //Put the result of the query in an array called $row  
    
    $user_id = $row['id'];    //Put the id from the $row array into the variable $user_id
    $hashedPassword = pun_hash($user->Password);    //hash the user's password using the punbb hash function 
    
    pun_setcookie($user_id, $hashedPassword, time()+24*60*60);  //Set the punBB cookie, which is called punbb_cookie

Where from does user_id come? I checked the users table, but i can't seem to find a column called user_id, only id and group_id.

So am i understanding this correctly?

pun_setcookie($user_id, $form_password_hash, $expire);

If the variables(username & password) of the user which is logged in on the website are fed to the pun_setcookie() functions as parameters, then when the user visits the forum he/she will be logged in?
Although i'm wondering $user_id might not be the same as username, neither might $form_password_hash imply the hashed password of the user.
So does pun_setcookie() basically set a few variables of a user's punbb_cookie? (Variables username and password?)

After implementing registration integration (See: http://punbb.org/forums/viewtopic.php?id=17964 ), i'd like to also implement login integration.
I've seen many threads and tutorials about this but most were about login integration by starting out with punBB and building a site around that.
We have an existing site with accounts which are now also injected into the punbb_users table upon registration, but when someone logs in on our site that user will only get logged onto the website and not yet punbb.
Once a user is logged in we can fetch the username and password using php.
I'd like to know how to use those variables to also log into the forums when a user goes into the forums and if this would be the way to do it in our situation or if there is another (better?) way. Does anyone know any tutorials/documentation/wiki/thread regarding doing it this particular way or can someone perhaps explain how to accomplish this?
So in short we're starting out with an existing website with an existing log in system and we want to integrate punBB into the process instead of starting out with punBB and build around it.

Ok the code works now. I made a typo. The path to the functions.php file is not punbb/includes but punbb/include .
So far so good. Thanks for your help Smartys. Really appreciate it.

Ok i found an error, i forgot to include punbb/includes/functions.php  so the pun_hash() function wasn't able to be called. But now it still doesn't work. Have i forgotten to import more files to make this work? Like common.php for example?

This is the code i have now with functions.php included:

 
$dbhost = 'localhost';
$dbuser = 'username';
$dbpasswd = 'password';
$dbname = 'punbbdatabasename';

$conn = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ('Error connecting to mysql');
mysql_select_db("$dbname",$conn) or die ("could not open db".mysql_error());

include "punbb/includes/functions.php"; 


    $group_id = "4";
    $user_regdate = strtotime ("now"); // Unix Timestamp
    $user_password=pun_hash($user->Password);
    $username=$user->Username;
    $user_email=$user->EmailAddress;
    $user_lang = "english";
    $user_timezone = "0";
    
    $query_ft = "INSERT INTO punbb_users (group_id, registered, username, password, email, language, timezone) values ('$group_id','$user_regdate','$username','$user_password','$user_email','$user_lang','$user_timezone')";   
    mysql_query($query_ft, $conn) or die (mysql_error());

And that gives the following errors:

Warning: include(punbb/includes/functions.php) [function.include]: failed to open stream: No such file or directory in /somepath/register.php on line 1222

Warning: include() [function.include]: Failed opening 'punbb/includes/functions.php' for inclusion (include_path='.:/usr/local/lib/php5') in /somepath/register.php on line 1222

Fatal error: Call to undefined function pun_hash() in /somepath/register.php on line 1226

I noticed that config.php in the punbb root directory has a few more variables set there. Is it possible i set too few variables to setup a proper connection to punbb's database?

quaker wrote:

then go find base.css
and add it there.
it will affect all the styles..

Q

Thanks.

Smartys wrote:

And the script runs fine without an error? But no row is inserted in the database?

I get no errors, but no row is inserted, double checked the database and the user table.

Smartys wrote:

He doesn't mean literally a file with the name style_cs.css. Replace style with the name of the style you're using. So Oxygen would be Oxygen_cs.css

Aha, thanks.

PS: Wouldn't that mean though that only Oxygen would be moved 20px down? Suppose a user chooses a different style in his/her, wouldn't the forum be at it's default position again in that style?

This is basically it:

    
$dbhost = 'localhost';
$dbuser = 'username';
$dbpasswd = 'password';
$dbname = 'punbbdatabasename';

$conn = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ('Error connecting to mysql');
mysql_select_db("$dbname",$conn) or die ("could not open db".mysql_error());


         $group_id = "4";
    $user_regdate = strtotime ("now"); // Unix Timestamp
    $user_password=pun_hash($user->Password);
    $username=$user->Username;
    $user_email=$user->EmailAddress;
    $user_lang = "english";
    $user_timezone = "0";
    
    $query_ft = "INSERT INTO punbb_users (group_id, registered, username, password, email, language, timezone) values ('$group_id','$user_regdate','$username','$user_password','$user_email','$user_lang','$user_timezone')";   
    mysql_query($query_ft, $conn) or die (mysql_error());

I can't seem to find that particular css file(style_css.css). What's the path? (using 1.2.16)

quaker wrote:

zentropy why put that in the main.tpl
add that to the style_css.css

add
#punwrap{
margin-top:20px;}

Q

Thanks for the tip, will do.

No the tables are not in the same database but i opened up a connection to the punBB database before the above mentioned code.

It looks like this:

$dbhost = 'localhost';
$dbuser = 'username';
$dbpasswd = 'password';
$dbname = 'punbbdatabasename';

after those variables are set the following code is included:

$conn = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ('Error connecting to mysql');
mysql_select_db("$dbname",$conn) or die ("could not open db".mysql_error());

Also for this to work, does e-mail verification need to be turned off?

I tried the following. When a user registers at out website i wanted that the registered information got also injected into the punbb database so that the user didn't have to register seperately later on the forums. But this didn't work, no user got added to the user table and neither was i able to login after registration. What am i doing wrong?

here's the code:

               
                $group_id = "4";
    $user_regdate = strtotime ("now"); // Unix Timestamp
    $user_password=pun_hash($user->Password);
    $username=$user->Username;
    $user_email=$user->EmailAddress;
    $user_lang = "english";
    $user_timezone = "0";
    
    $query_ft = "INSERT INTO punbb_users (group_id, registered, username, password, email, language, timezone) values ('$group_id','$user_regdate','$username','$user_password','$user_email','$user_lang','$user_timezone')";   
    mysql_query($query_ft, $conn) or die (mysql_error());
Hob Bramble wrote:

So long as you put the menu above the forum content, the forum should move down by itself.

That didn't work. I tried the following in main.tpl:

<div id="punwrap" style="position:relative; top:20px;">

And it seemed to work.

Thanks, that worked.
Now i only need to know how to move the entire forum down. Does anyone happen to know if this is possible?

I'm trying to place a menu from our website at the top of the punBB layout.
The menu uses php.

1) Where should i place the html & php code for the menu. (I thought about main.tpl , but tpl files don't get parsed by the php engine right?)

2) How do i move the entire forum down a bit so there will be room at the top to place the menu.

45

(5 replies, posted in PunBB 1.2 discussion)

Thanks, that's great

46

(5 replies, posted in PunBB 1.2 discussion)

Is it also possible to create forums within forums? For example when a user enters a forums called "Projects" then the plan is he/she should be able to enter his/her own project forum. I know forums are displayed on the board index, but if many users create projects the board index would become quite long.

47

(5 replies, posted in PunBB 1.2 discussion)

0) Login and registration integration with an existing website
1) Private messages
2) Private forums (passworded forums)
3) We have a website we like to integrate with a forum. Users on this website can create projects. I'd like for each project that a user creates, that there will be a private passworded forum added to the list/index of forums.

Is this possible with punBB? If so how?