Topic: What is the database prefix used for?

The database prefix, that you had the option of putting in during the install.

I'm pretty new with all this stuff, so this may sound dumb.

Anyway, I'm hoping to get two punbb's running on my website, only both of them will share the same users and user settings.
Basically, I was hoping to make kind of a subforum type thing, only instead of a sub forum, it would link to another forum altogether. This would help me be able to customize each section more thoroughly than I would with the sub-forum mods.

I was wondering if this is at all possible, and if maybe that is what the database prefix is for?

Thanks for any help.

Re: What is the database prefix used for?

The database prefix allows you to have multiple copies of PunBB reside in one database.
To share the same users, you'll have to rewrite all the queries involving the users table in one copy of PunBB so that it uses the other forum's DB prefix

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: What is the database prefix used for?

I was thinking of maybe trying to do what you said, but as I thought about it, I thought of a few potential problems.

I pretty much want it to share everything except forums and posts. What I was thinking of first, would leave out post count, signatures, possibly password changes. (I'm not really sure, I'm just guessing from my limited understanding of what you just said)

What I want to do is have two different forums running, one for discussion, and one for talking about video game projects people have been working on.
The thing is I would like them to be seperate, as to reduce clutter. And I'd also like them to have different mods and settings. Such as the image tag, I really didn't want to
allow image tags to be used on my forum, but they really are needed in the project area. And if I ever consider any mods, my two sections have very different needs, so it would be nice to keep them seperated. I'd like it if they only had to sign up once, though.

What would be the best way of going about this? Is it reasonable to do this at this point, or would it be more effort to make and uphold than it's worth?

Re: What is the database prefix used for?

Using one user database for both forums means one account for both forums. Post counts would still work (but they would be a total of posts in both forums), signatures would work, password changes would work.

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: What is the database prefix used for?

Okay, thanks for answering so quickly.

Could you tell me how to do this, or is it documented somewhere.
I'm not to good with php, I have very limited knowledge of it. Do you think it's still something I could do?
I'm willing to put a lot of time into it if it can get things working the way I want.

Thanks.

6 (edited by Smartys 2006-08-28 23:34)

Re: What is the database prefix used for?

It isn't documented, you just have to think about where the user table would be called from (login.php, register.php, functions.php, etc) and edit those queries to change the prefix

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: What is the database prefix used for?

FWIW, I count 16 files and 61 queries. (I don't think there are any mods included in those numbers.)

Re: What is the database prefix used for?

Well, I looked around for a while trying to find the information I needed.
I'm not sure exactly what I'm looking for though.

If I'm understanding you, I need to find the prefix for users in my first database, and in the files for my second forum, replace all references to users with another piece of code, that references the first database.

I was looking through my database using phpmyadmin, and I clicked on "users" but there was quite a bit of information there, and I wasn't sure what I was looking for.
I also don't know what text to replace with what on the second forum.

It might be helpful if you give an example, if it's not to much trouble.

Re: What is the database prefix used for?

The best thing would be to use a program that goes replacing in all the files =P Just change

".$db->prefix."users

to

"whateveryourprefixmaybe_users

And it'll be solved.

Re: What is the database prefix used for?

Could you add something like this to config.php and replace with that instead?

define('INTEGRATED_PREFIX', 'whatever');

Maybe one of these editors can help you find/replace.

Re: What is the database prefix used for?

Okay, I think I understand what I need to do once I know the user prefix, it seems pretty straight forward.
On the other hand, I'm getting really confused looking through my database. I'm not sure what I'm supposed to be looking for, or where to be looking for it.
Could anyone tell me where I might look for it in phpmyadmin? Or should I be using phpmyadmin, I might be missing some tool I need. Databases are something I know nothing about.

Also, I'm going to try and get both forums on one database, so where can I find the database table prefix I'm looking for?

Re: What is the database prefix used for?

Well, first of all, install the two forums. Assign each of them a prefix, like inst1_ and inst2_. Then you decide which installation to use as the main one. After that you just edit the other installation to have the chosen prefix for the users table instead of ".$db->prefix.". So you'd edit your second installation to work with the first like this:

Replace

".$db->prefix."users

with

inst1_users

I know Dreamweaver can replace in all the files of the local site etc.

Re: What is the database prefix used for?

You don't even need to look in your database; The prefix is stored in config.php (which you create after installing).

Re: What is the database prefix used for?

I really don't know whether the solution presented in it works or not, but a similar topic that popped up a while back.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: What is the database prefix used for?

Okay, I actually got it to work using test forums. The problem I've run into now, is that my main forum, which is already installed and everything, doesn't have a database table prefix. I tried just giving it one in the config.php, but it didn't work (I didn't really expect it to, but it was worth a try)
I need to actually change the database, how can I do this?

Re: What is the database prefix used for?

No need to change the database, as long one of the forums has a prefix wink

Re: What is the database prefix used for?

I finally got the two forums up, and they both have all the same users.
I'm having a problem though, for some reason, on the second forum (which is the forum that uses the first forums user database) people can't log in, except me, the administrator.
They try to log in, it says that they have succesfully logged in, and they will be redirected, but then aren't logged in.
The page has the "log in" button, and they haven't really logged in.

It kind of looks like a cookie issue to me. I changed the cookie seed to the same cookie seed of the first forum, as said in the thread pogenwurst posted. I'm not sure if this caused the problem or not. I didn't save the original cookie seed, unfortunatley, so I can't test.

Re: What is the database prefix used for?

What are the URLs for the forums?
What is $cookie_name set to for each (it should be the same)

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

19 (edited by Plubyblop 2006-08-30 17:23)

Re: What is the database prefix used for?

The URL's:

http://www.christianepic.com/forums3
http://www.christianepic.com/projectforum

However, I don't know what $cookie_name is set to, which I would assume is the problem.
Where can I find it?

Re: What is the database prefix used for?

config.php

21 (edited by Plubyblop 2006-08-30 18:02)

Re: What is the database prefix used for?

Okay, I checked it, they are both set to the same thing, as with the cookie seed.
None of the other cookie information is specified though, could that possibly be the problem?

Also, I was just checking through the files to check and see if there were any mistakes I had made changing the files, I searched "users" and I found a couple of these:

'.$low_prio.$db->prefix.'users

They didn't show up because I had been searching for

'.$db->prefix.'users

What should I change this into, if I did it exactly the way I was doing the other ones it would be:

'.$low_prioforum1_users ---- forum1_ being the database prefix.

but I doubt i'm supposed to mash them together like that, what needs to be in there to seperate them?

Re: What is the database prefix used for?

Change it to '.$low_prio.'users smile

Re: What is the database prefix used for?

No, '.$low_prio.'forum1_users
Assuming forum1_ is the prefix for the users table you're using

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: What is the database prefix used for?

Smartys wrote:

No, '.$low_prio.'forum1_users
Assuming forum1_ is the prefix for the users table you're using

He said before his first forum has no prefix wink

Re: What is the database prefix used for?

Actually, I had to go in and give it one, I found in another thread that that was possible,
sorry I forgot to mention that.
I've been looking at the other thread about this, and he said it he couldn't ever get his working either, maybe this was the problem he ran into.
I checked it out using my test forums, and they have the same problem, I just didn't notice it before, because I had been testing it using the administrators.
I've been looking around and I can't find any solutions.

Though in the other thread, the guy said at one point that he had it working, they just had to logig to every forum. I might try to get it to work like that, if they stay logged in   
a long time, it will hardly be noticable. I'll only try that if I can't find any other solution though.