News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Share user database for 2 (or more) different forums.

Started by Spaceman-Spiff, September 03, 2004, 09:14:44 PM

Previous topic - Next topic

theunder-ground

I have 1 forum established and 1 that I am going to be opening up soon.

I shared the following tables:

members
im_recipients
instant_messages
membergroups
attachments
log_online
themes

I also have the new boards attachments setting to point to the origional board attachment setting.

I have a few problems.

1. I added another field using Unknown's tutorial http://www.unknownbrackets.com/tutorials/custom-profile what I added is not being transfered to the new board. 

2. None of the user uploaded avatars are showing

3. Even using the code provided by Unknow the stats will not count themselves properly.  I have to manually go in and have them recounted.

4. My membergroups are not able to see the posts on the new forum.  I am thinking that I may need to have the permissions and board_permissions tables shared as well.  Is that correct?

The 2 forums are on the same database, the new forum is a sub-domain of the main URL

silverdragonrs

ok.... i was fine understanding all this untill people started talking about mambo ans such.... what the heck is mambo? i am running SMF off of my own server...(running apache2triad) I have 7 forums and i need to merge 5 of them.... i am running 1.0.7 and heve no intentions of upgrading or changing it any time soon (if it aint broke dont fix it theory)

how can i successfully merge these forums. I understand the original procedure but it is a couple years old and the versions have changed. nobody has posted a fix in a while... not sure where to go from here...... could somebody post new instructions for the updated versions please.. if its the same then please say so. mean while i will test these instructions (those i understood) on a fresh install of SMF and try and link it to one of the others.....

could you tell me what mambo is for and how it would benifit? and tell me if i get you right.. if i use mambo (what ever it is) I can merge all my forums with only a few lines of code as opposed to going through ALL this? or does using this only save a few steps?

thanks,
danny
I'd like to quote my idol. Homer Simpson. "Press any key now!... Any Key? Where's the any key?!... Doh!" ---- One day I'll be that good with computers..... ~ danny ~ feel free to IM me about anything!

Goosemoose

Yes, using Joomla or (used to be mambo but there was a split of the software and now they both exist) the shared can be done with only a few lines of code. Check out http://www.goosemoose.com/ and go to Pet Forums. All the forums you see are actually one SMF install made to look like multiple forums.

BUT it's only easy to create the multiple shared forums. If you have pre-existing forums then that is a whole other ball of wax. I don't have any good suggestions on an easy way to accomplish this, as it's not easy. I merged 3 originally and it required changing all the id's for posts, topics and members, and isn't an easy task. Maybe someone else has an easier solution.

silverdragonrs

I think i have found a solution to many of the problems... but still have the problem of.... I HAVE NO CLUE WHAT I AM DOING!!! :) no really.. I have gotten almost nowhere... i have a theory though..... is it ok if I PM you with it and if it works then it can be posted... I don't want to post something that may be midtaken as a solution and mess up somebodies forums...:(  PM me if it's cool goosemoose

Thanks,
danny
I'd like to quote my idol. Homer Simpson. "Press any key now!... Any Key? Where's the any key?!... Doh!" ---- One day I'll be that good with computers..... ~ danny ~ feel free to IM me about anything!

starbois

Hi

Can someone from SMF help to post the codes for 1.1RC1 to replace the one from version 1.0x.

Appreciate.


Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]

starbois

Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.




LostProphecy

i've been looking at this and also looking at the mambo one that i think goosemore suggested and i'm trying to work out which would be better for me,

i currently have a 180 member forum with about 70,000 posts and i would like to create a multiple forum layout, i am not too fussed on which way it gets done.

I know nothing about mambo or portals or anything like that.

I would like each forum to have different membergroups, i don't know if this can be done or it just wont work, my current site is a harry potter site so it has membergroups that are the 4 houses, i want to create some other movie sites so obviously i don't want lets say we have member x that is in "gryffindor" when they go over to the lord of the rings forum i do not want member x showing up as being in 'gryffindor' for that forum i might want member x showing up as say "elf", will just not sharing the membergroup table fix this? or will it create more problems then it's really worth.

On the theme issue, if you were using a default theme allround and then using set themes for certain boards (you know the option in the board menu where you make a theme display on a particular board) will this work? as it is not a theme setting that is in the members table it is a setting that is in the boards area.

Will mods like the membermap and the SMFshop become a globalised thing (showing up the same on all forums) or will they always be a "per forum" thing.

Is it possible to keep the karma as a per forum thing? or will that stuff up cause karma appears in the shared members table?




i suppose in the end all i want to keep shared is the members, their personal details and sigs and avatars, their post counts, the membermap, their online time (although i think differing online times could be very cool - being able to see who spent the most time on which forum), and the themes...

although now that i think about it, i also may  not mind even the post counts not being shared... i'm sure i could think of a way of creating a main page where they could go and see their "total personal statistics"




i'm an obsessive sort of person so i have absolutely no problems with spending hours upon hours and days upon days in even manually modifing things if i can get this to work, if i had to i would even go through all my 70,000 posts and hand change ever link that might happen to get changed if my forum gets moved to another directory... i love my site so i would pretty much go to any lengths to get it the way i want so any suggestions no matter how time consuming they are, are very welcome to me :)

~Jessi
Angelus Ex Quo Nox

Goosemoose

Ok, first my mambo/joomla mod would be just like one smf forum except for the fact that you can view certain categories on each forum. Any mod applied would appear across all the forums. You can use multiple membergroups just like regular smf, but you'd have to insert your own code to make certain groups show on certain sites. Basically what you are talking about is going to take quite a bit of modification no matter how you swing it.

LostProphecy

i realised that but i'm definitely up for the challenge trust me ;)

i have no life outside of work... so plenty of nights and weekends for me to waste on this baby :P
Angelus Ex Quo Nox

LostProphecy

I've almost got my 7 forums fully intergrated with each other...

but i'm having issues with the log_online part.

for some reason even though i've shared the log_online table as well as setting all cookie names to be the same i can't log into one forum and then jump to another and also be online there... i've checked and double checked and i can't seem to see a reason as to why this isn't working. Everything else is working fine for me and i like the way it works...

the only thing i dont like is the shared membergroups but i can't do anything about it as that info is stored in the member table so nothing can be done abou that :)

can anyone possibly help with this issue?

what is the session table for? would that help my problem if i shared that table?
Angelus Ex Quo Nox


LostProphecy

yes they are... and in the same database as well listed as smf1 through to seven

www.lostprophecy.com/central/index.php
www.lostprophecy.com/arts/index.php
www.lostprophecy.com/controversy/index.php
www.lostprophecy.com/entertainment/index.php
www.lostprophecy.com/harrypotter/index.php
www.lostprophecy.com/rpg/index.php
www.lostprophecy.com/tech/index.php

what i've done is basicly spent the last 2 weeks multiplying my current forum that is currently residing in the "forums' folder and copied all the exact same files over 7 times over and then went in and manually redirected each theme to it's appropriate urls and then changed all the database thingys to point to each one, everything including the PM's is following me around the 7 forums and stuff... everything except the online thing, i had to log online 7 times to be online everywhere
Angelus Ex Quo Nox

Goosemoose

Ugh. That's what I used to do. Using the shared forum mod with joomla makes it so much easier. Go ahead and share the sessions mod, that should solve your problem. Make sure all the cookie names are the same too.

theunder-ground

I for the life of me can not get the uploaded avatars to show from the main forum to the other.

The main forum is http://www.theunder-ground.com
Second forum is http://illusions.theunder-ground.com

Almost everything else is working between the 2

LostProphecy

Just wondering if someone might be able to help me out...

i've noticed two things on my 7 forums that i wish to try and fix...

Firstly,

the recycling bin, i want to have a recycling bin for each forum however something seems to go astray everytime i try to set it, it appears to be a setting problem to me on forum 1 i have the recycling bin set to board 213... on my second forum when i try to set my recycling bin to board 193 it ends up not liking it and then all forums i go to (have 7 of them) have the recycling bin is set to whatever board 213 is on that particular forum...

Is there anyway of fixing this? i would like the recycling bin to be individualised for each forum...

a similar thing seems to be happening with my stats, each board has a different amount of posts and threads

If say i go into forum 1 and recount the totals it will count them to say 20,000 posts
then i go to forum 2 and recount the totals which comes to 40,000 posts
If i then go back to forum 1 the stat's now tell me that my forum now has 40,000 posts (when i know it only has 20,000 posts)... i don't get why this is happening either as the code when i look at stats.php pulls all it's numbers from the database using {db_prefix} so technically it should head straight to the database prefix that the forum is set to...

I did the modifications stated below

Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.


And i have shared the following database tables

{$db_prefix}members ==> smf1_members
{$db_prefix}personal_messages  ==> smf1_personal_messages
{$db_prefix}pm_recipients  ==> smf1_pm_recipients
{$db_prefix}themes ==> smf1_themes
{$db_prefix}log_karma ==> smf1_log_karma
{$db_prefix}log_online ==> smf1_log_online
{$db_prefix}log_floodcontrol ==> smf1_log_floodcontrol
{$db_prefix}membergroups => smf1_membergroups
{$db_prefix}mm_maps ==> smf1_mm_maps
{$db_prefix}mm_pins => smf1_mm_pins
{$db_prefix}shoutbox => smf1_shoutbox
{$db_prefix}sessions => smf1_sessions




I would really appreciate if someone could even just give me the tiniest guideance on this :)

~Jessi
Angelus Ex Quo Nox

LostProphecy

never mind about above...

i've fixed the issue and found it to be the code modification above that causes all my issues...

I just thought that i would let everyone know incase they have similar issues...

the above code my auto update all member counts when a new member joins but at the cost of not being able to have individual board statistics and not being able to set individual recycling bin boards then i think i would rather opt to go through and recount forum statistics every time a new member joins up :)
Angelus Ex Quo Nox

†MavN†

SMF 1.1 RC3
I have some strange error. I have shared this tables

{$db_prefix}ban_groups
{$db_prefix}ban_items
{$db_prefix}log_banned
{$db_prefix}log_errors
{$db_prefix}log_karma
{$db_prefix}log_online
{$db_prefix}membergroups
{$db_prefix}members
{$db_prefix}permissions
{$db_prefix}personal_messages
{$db_prefix}pm_recipients
{$db_prefix}sessions
{$db_prefix}themes

All working fine but when I am calling ssi_examples.php I have this error

: No database selected
D:\XAMPP\htdocs\smfru\Sources\Load.php
1962

I have this error only if I have share 2 tables

{$db_prefix}members
{$db_prefix}sessions

{$db_prefix} I am replaced to smfrc_ (db prefix another forum). What I am doing wrong?

nathan42100

BEFORE you all start yelling at me for bumping an old topic I just want to say that I chose this thread because it seemed to have the most info about doing this.


NOW, is the code below the most recent and has anyone made a mod that applies the below modifications if they are?
Quote from: LostProphecy on August 21, 2006, 02:32:25 AM
...
Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.


And i have shared the following database tables

{$db_prefix}members ==> smf1_members
{$db_prefix}personal_messages  ==> smf1_personal_messages
{$db_prefix}pm_recipients  ==> smf1_pm_recipients
{$db_prefix}themes ==> smf1_themes
{$db_prefix}log_karma ==> smf1_log_karma
{$db_prefix}log_online ==> smf1_log_online
{$db_prefix}log_floodcontrol ==> smf1_log_floodcontrol
{$db_prefix}membergroups => smf1_membergroups
{$db_prefix}mm_maps ==> smf1_mm_maps
{$db_prefix}mm_pins => smf1_mm_pins
{$db_prefix}shoutbox => smf1_shoutbox
{$db_prefix}sessions => smf1_sessions




I would really appreciate if someone could even just give me the tiniest guideance on this :)

~Jessi

Goosemoose

Check out my shared forum mod. There is a post towards the end that explains how to use the mod in a non joomla environment. It's much much much easier than this method.

nathan42100

Would that work for creating a completely separate "wiki"forum?

Advertisement: