I'd still like to know where the code is handled for creating a (sub)forum and where the actual link is created on which users click to enter the (sub)forum.
Does anyone happen to know?

*bump*

We have integrated our website with punbb.(Registration & login/logout)
What we're trying to do now is the following.

We have implemented the Sub Forum Mod to our punbb forum and are trying to automatically add new sub-forums. The reason for this is that users on our website can create projects. Other users can join those projects. What we intend to do is automatically create a new sub-forum every time a user creates a new project. So that is goal 1.

Goal 2 is that once other users have joined an existing project they can enter the sub forum. Though if they have not joined a particular project, then they are not allowed to enter the sub-forum of that particular project.

So my questions regarding this are as follows:

1) Where should i look to see how (Sub)-Forums are created, so that i can automate the process. (Where is the code for that, in which file and around which line?)

2) When a user tries to enter a sub-forum i want to execute a piece of PHP code that pulls the names of users out of our database which have joined that particular project and then match those names against the name of the logged in user that tries to enter the particular sub-forum and in that way determine if he/she may enter the sub-forum or not.
In order to do this i need to know where the code is positioned that handles a user entering a sub-forum. Once i know that i might be able to add to that code. Does anyone happen to know in what file that code is handled and around which line?

3) Can anyone provide me with advice/tips regarding this in general?

Thanks bingiman.

Thanks Mark.

I tried to install Sub Forum Mod 1.0.9.3 for punBB 1.2.16 ,  but when running the installer it says the following: You are running a version of PunBB (1.2.16) that this mod does not support. This mod supports PunBB versions: 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.2.14, 1.2.15

What are my options to still be able to run this mod? Or should i rather wait for a new release of this mod? If so does anyone happen to know when a new release with compatibility with punBB 1.2.16 is planned?

Thanks Smartys.

I'm wondering if the following mods are compatible. What i mean with this is i'd like to create sub forums which are also password protected, but i'm not sure if that can be done with these 2 mods.

1) Sub Forum Mod - http://www.punres.org/viewtopic.php?id=594&p=1

2) Password protected forums - http://www.punres.org/viewtopic.php?id=706

I'd like to put a logo in the header left of the bold title. I'm trying to find the exact div or table in which i can put the image of the logo, but i'm not sure in what file this div resides.

Smartys wrote:

From the navlinks on the top? include/functions.php
Registration can also be disabled via the admin panel.

Thanks Smartys.

We have completed registration and login integration of our website with punbb, but users can still login or register via the forums. We want to prevent that to keep our website database and punbb database symmetrical regarding accounts. So i'm wondering what would be the best way to do this and in what file can those elements be removed?

Thanks guys!

Dr.Jeckyl wrote:

It's in Admin Options.

Do you mean the Admin Options when logged in as admin and not admin_options.php ?
If so when changing the directory name should i first change the base url and then rename the directory or is that possible also after the name change of the directory?

Smartys wrote:

base URL: that's it, by default

Where is the definition of base URL located? (What file)

Our punBB forums are now located in /punbb , though i intend to change that directory to /forums.
When i change the name of the directory though, what else should be changed with it? I assume renaming punbb's root directory might break some things and thus cause punbb not to work properly.

Furthermore for people who will stumble upon this thread and try to accomplish the same, here is the full working code:

<? 
define('PUN_ROOT', './punbb/');
include 'punbb/include/common.php';    //Include this file so that $pun_user['is_guest'] can be used and that (some?) functions from punbb/include/functions.php can also be used in this script


if (($websitelogin==true) && ($pun_user['is_guest'])) {
    
    
    include "./punbb/customforumdbconfig.php"; //Custom file which contains and sets the variables for setting up a connection to the punbb database
    include "opendb.php"; //Script that uses the above mentioned variables to open the actual connection with the database
    
    
    $username = $user->Username;  //Get the username of the logged in user and put it in a variable     ($user->Username comes from code from the website which is intended to get login integration with punbb through this script)
    
    $queryFromPunbb = "SELECT * FROM punbb_users WHERE username='$username'";    //get the row with 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 
    $expirationTime = time()+24*60*60;
    
    pun_setcookie($user_id, $hashedPassword, $expirationTime);  //Set the punBB cookie, which is called punbb_cookie
    
    include "closedb.php"; //Include a script which closes the connection with the punbb database

header("Location: ./punbb"); //send the browser to the /punbb directory
}
elseif (($websitelogin==true) && !($pun_user['is_guest'])) {
    header("Location: ./punbb"); //send the browser to the /punbb directory
}
elseif (!($websitelogin) && ($pun_user['is_guest'])) {
    header("Location: ./punbb"); //send the browser to the /punbb directory
}
else {
    exit("Error: website login flag and/or guest flag exception"); //Print error to screen and terminate the execution of the script
} 
?>
Smartys wrote:

Which means don't include functions.php when including common.php since common.php takes care of that for you wink

Victory! That did the trick. It's working now.
Thanks Smartys, i really appreciate it you took the time to help me out. Thanks and Kudos!

Smartys wrote:

You can't just include functions.php: well, you can, but since you're lacking common.php you're missing out on lots of variables. I think you should try including config.php.

When including config.php it still seems to not log me in. I also tried including common.php, though when doing that i get the following error upon going to the forums:

Fatal error: Cannot redeclare check_cookie() (previously declared in /root/punbb/include/functions.php:28) in /root/punbb/include/functions.php on line 112

This is what i get when echo-ing out the variables right before i pass them as parameters to the pun_setcookie() function.
In sequential order: $user_id $hashedPassword time()+24*60*60

3 206c80413b9a96c1312cc346b7d2517b84463edd 1200195464
Smartys wrote:

The cookie set, in other words, is not the same.

What does that imply in this instance? Could it be that the password somehow does not hash correctly?

And this is the output on index.php when i'm successfully logged in:

Array
(
    [punbb_cookie] => a:2:{i:0;s:1:"3";i:1;s:32:"5ec70ea77e7b20ef464b8489d391a07b";}
    [__utma] => 37521701.265511199.1199912689.1200091902.1200106214.15
    [__utmz] => 37521701.1199912689.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
    [style_cookie] => printonly
    [__utmc] => 93837953
    [PHPSESSID] => 1c3bd95e6dhrs18pkr7aki8t40
    [phpbb3_2rojj_u] => 1
    [phpbb3_2rojj_k] => 
    [phpbb3_2rojj_sid] => 4e3437741406faee467a71d53f29fb98
    [a:2:{i:0;s:1:\"3\";i:1;s:32:\"09202be3249d1bd81d509b9c9977da5b\";}] => 
    [__utmb] => 37521701
)
Smartys wrote:

$_COOKIE isn't updated until the next pageview wink

This is the output from the cookie when using print_r($_COOKIE); on the punbb index.php page. (Am not logged in when this output displays)

Array
(
    [punbb_cookie] => a:2:{i:0;i:1;i:1;s:32:"684c51e53a07a80952d831dad741cc59";}
    [__utma] => 37521701.265511199.1199912689.1200091902.1200106214.15
    [__utmz] => 37521701.1199912689.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
    [style_cookie] => printonly
    [__utmc] => 93837953
    [PHPSESSID] => 1c3bd95e6dhrs18pkr7aki8t40
    [phpbb3_2rojj_u] => 1
    [phpbb3_2rojj_k] => 
    [phpbb3_2rojj_sid] => 4e3437741406faee467a71d53f29fb98
    [a:2:{i:0;s:1:\"3\";i:1;s:32:\"09202be3249d1bd81d509b9c9977da5b\";}] => 
    [__utmb] => 37521701
)

This the the output i get from printing the content of the cookie using print_r($_COOKIE); exit; after running the script posted above.
With this output i don't get logged in. (Not sure if the content of the cookie is at fault offcourse)

Array
(
    [punbb_cookie] => a:2:{i:0;i:1;i:1;s:32:"684c51e53a07a80952d831dad741cc59";}
    [__utma] => 37521701.265511199.1199912689.1200091902.1200106214.15
    [__utmz] => 37521701.1199912689.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
    [style_cookie] => printonly
    [__utmc] => 93837953
    [PHPSESSID] => 1c3bd95e6dhrs18pkr7aki8t40
    [phpbb3_2rojj_u] => 1
    [phpbb3_2rojj_k] => 
    [phpbb3_2rojj_sid] => 4e3437741406faee467a71d53f29fb98
    [a:2:{i:0;s:1:"3";i:1;s:32:"09202be3249d1bd81d509b9c9977da5b";}] => 
    [__utmb] => 37521701
)

I'm wondering though if running the pun_setcookie() function will be enough to log a user in into the forum. (Is that really all that is required to log in a user?)
The pun_setcookie function(as seen in the code i posted) is run from a file on our website, which is in the root directory, while punbb is in /punbb .

Ok, i tried the above, setting the cookie, but it didn't get me logged in when visiting the forums.