Topic: 4 forums in one database

Hi Guys,
I've 4 forums that uses the same database( but I use different uesername for each forum).
Now users have to register and login seperately for each forum,but I want to know if there is a way sothat when you register and login for one forum,then you don't need to do for the others.
I've used different prefix for each forum.Shuld I remove prefixex from users table?or what?

2

Re: 4 forums in one database

you have to search your whole punbb folder for
$db->prefix.'users
then change the prefixes

Re: 4 forums in one database

What you mean when you say whole punbb folder?Should I search in all the .php files?Isn''t there anyother -easier- way- for example to change something in database?

4

Re: 4 forums in one database

maybe you can somehow link two tables.

searching and replacing in all .php files isn't difficult. you have to use the right programm. weaverslave can do that (http://www.weaverslave.ws/)

Re: 4 forums in one database

i guess an easier way would be to open /include/dblayer/mysql.php (assuming you use mysql) and adding a replace to the query function to replace bleh_users to users or whatever.

Re: 4 forums in one database

yes, I use mysql but since I don't know anything about php, I don't know how to add a replace to the query fuction.

7 (edited by Tobi 2005-09-14 08:16)

Re: 4 forums in one database

Something like

$sql = ereg_replace($this->prefix ."users", "YOURTABLEusers", $sql);

Should work .
It must be placed in line 76 of include/dblayers/mysql.php

Replace YOURTABLE with the prefix of the usertable that you want to use.

The German PunBB Site:
PunBB-forum.de

Re: 4 forums in one database

Thank you Tobi.I did it and it works.Now users need to register only once.
But the second problem is still there.They have to login every time they go to another forum.no solution?

Re: 4 forums in one database

Is it on the same site, but differnet subdomains?

Re: 4 forums in one database

my forums folders are:
..forum/humanities
..forum/engineering
..forum/health
..forum/science

should I give more details?

11 (edited by Smartys 2005-09-15 01:13)

Re: 4 forums in one database

Nope, sounds good smile
Just make sure the cookie name in config.php is all the same smile

Re: 4 forums in one database

I check them.All of them were something like this:
$cookie_domain = '';
I'm going to try this:
$cookie_domain = 'mydomain.com/forum/humanities';
(since I want the users who regoister and login for humanities can use the other forums.)
Should I add the http:// prefix to my domain  or not?

Re: 4 forums in one database

Well, there are going to be issues if you change password on one forum tongue
IMO you would have been better off with different categories for each subject, and used something like this.

Re: 4 forums in one database

In fact I thought about that.But I have to use sub-categories and since I could not find any subcategory mod for punbb, then I used sub-foums.But after all I was forced to use different forums for parent categories. any way thanks a lot for your help.

Re: 4 forums in one database

You mean something like this?

Re: 4 forums in one database

yes. I mean that mod. But if we had some mod for creating sub-category, then I was possible to include all my forums in only one.By the way, is there any sub-category mod for punbb?

Re: 4 forums in one database

I tried the do what FLX said, but it was no help. I did not work...

18

Re: 4 forums in one database

I know that this is an old topic, but could you tell us what happened with you forums?
u got all the users registered for all forums but still thye have to login for each is that right?

فهد

19

Re: 4 forums in one database

did u set the each config.php cookie to the same thing?
<?php

$db_type = 'mysql';
$db_host = 'localhost';
$db_name = 'name_forum';
$db_username = 'name_forum';
$db_password = 'bigmama';
$db_prefix = '';
$p_connect = false;

$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = '275be39a'; <---------------------------did u set then all to the same thing?

define('PUN', 1);

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: 4 forums in one database

I did nothing. I had to change all my plans and work with only one forum.

21

Re: 4 forums in one database

Gday all,

Tobi you posted this,

Something like

Code:
$sql = ereg_replace($this->prefix ."users", "YOURTABLEusers", $sql);
Should work .
It must be placed in line 76 of include/dblayers/mysql.php

Replace YOURTABLE with the prefix of the usertable that you want to use.

dbplyers dosnt exist on my installation, im running the latest version, any solution?

Cheers, james

22 (edited by twohawks 2007-02-08 21:47)

Re: 4 forums in one database

Followup to Tobi's method:
   I am working on an archive method (or two, see here: http://www.punres.org/viewtopic.php?pid=13630 )
and using Tobi's method for utilizing the "main" forum's user database for the "archive" forum. 

I found it works most completely if  I add the following lines at Line 76:

        $sql = ereg_replace($this->prefix ."users", "MAINFORUMPREFIXusers", $sql);
        $sql = ereg_replace($this->prefix ."groups", "MAINFORUMPREFIXgroups", $sql);
        $sql = ereg_replace($this->prefix ."online", "MAINFORUMPREFIXonline", $sql);
        $sql = ereg_replace($this->prefix ."forum_perms", "MAINFORUMPREFIXforum_perms", $sql);
        $sql = ereg_replace($this->prefix ."reports", "MAINFORUMPREFIXreports", $sql);

I am sure it can be re-written to be less code, but the idea is it allows for seemingly unequivocal (comprehensive) management of the users and their permissions from a single (the main) forum. 

Since I am using the code I thought it would be useful to post this here.
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: 4 forums in one database

If you're replacing a set string, ditch the ereg. Really.

$sql = str_replace($this->prefix ."users", "MAINFORUMPREFIXusers", $sql);
$sql = str_replace($this->prefix ."groups", "MAINFORUMPREFIXgroups", $sql);
$sql = str_replace($this->prefix ."online", "MAINFORUMPREFIXonline", $sql);
$sql = str_replace($this->prefix ."forum_perms", "MAINFORUMPREFIXforum_perms", $sql);
$sql = str_replace($this->prefix ."reports", "MAINFORUMPREFIXreports", $sql);

Re: 4 forums in one database

Thank you.  I had not looked up the comand.  I understand.
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

25

Re: 4 forums in one database

Now that this has been dragged back up, big_smile just to double check, those str_replace lines would need to go after:

function query($sql, $unbuffered = false)
{

in the db script?


Cheers,

Matt