Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: brianjw on October 31, 2008, 04:08:32 PM

Title: Could someone help me make this work...
Post by: brianjw on October 31, 2008, 04:08:32 PM
This was for the topic here: http://www.simplemachines.org/community/index.php?topic=16190.0


Hi,

I am having this same problem:
Quote from: Nic on October 26, 2004, 11:41:05 AM
Firstly, thanks SO much for this post - it was exactly what I needed.  I now have two forums for two sub-domains on the same site using one member table, which is just what I wanted.  however, I did notice one thing (no biggy, but wondered if I could fix it).  If someone registers on one forum, the member count automatically adds another one on, but on the other forum it doesn't and I have to tell it to recount the totals.  it's not a big hassle at the moment, since both forums are just new and not many people are registering, but if the forums get bigger it could be annoying having to recount totals each time a new member joins.  Is there any way around this?
and the fix for it was:
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]

But I cannot find those codes for SMF 1.1.6. Can someone help me with it? Thanks.
Title: Re: Could someone help me make this work...
Post by: N3RVE on November 03, 2008, 05:09:51 AM
You can use "Find in Files" feature in notepad++.
Put some of that code in the search box and point it to a fresh extracted SMF Package.
It will go through all SMF Files and return a list of files with that code in them, that's what I use when I need to find a line of code from SMF 1 in SMF 2 :)

-[n3rve]
Title: Re: Could someone help me make this work...
Post by: brianjw on November 03, 2008, 05:01:02 PM
[n3rve],

You do not understand. The code that I posted from the quote made by Unknown was from like the 1.0 branch. If someone can find what is supposed to be the same code but for 1.1, that would be great.

Thanks,
Brian
Title: Re: Could someone help me make this work...
Post by: brianjw on November 20, 2008, 04:42:36 PM
*BUMP*
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on November 21, 2008, 11:22:14 AM
Edit the updateStats() function in Subs.php in the same way. Only the 'member' case but.
Title: Re: Could someone help me make this work...
Post by: brianjw on November 21, 2008, 04:05:02 PM
Thanks [SiNaN], now known as Blue Dream. :)

I will try it, and let you know how it goes.
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on November 24, 2008, 07:43:11 AM
Any updates?
Title: Re: Could someone help me make this work...
Post by: brianjw on November 24, 2008, 04:16:53 PM
Sorry, haven't tested it yet. I will be testing it tonight.
Title: Re: Could someone help me make this work...
Post by: brianjw on November 27, 2008, 02:20:21 PM
Blue Dream/[SiNaN],

I am confused by the coding inside this file... Could you please provide the simple Find & Replace instructions if possible. For SMF 1.1.7.

Thanks,
Brian
Title: Re: Could someone help me make this work...
Post by: brianjw on November 30, 2008, 11:10:22 PM
Bump
Title: Re: Could someone help me make this work...
Post by: brianjw on December 03, 2008, 04:10:00 PM
:) Bump
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on December 06, 2008, 11:26:01 AM
Find:

updateSettings($changes);

Replace:

foreach ($changes as $key => $change)
{
         db_query("
            REPLACE INTO prefix1_settings
            VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);

         db_query("
            REPLACE INTO prefix2_settings
            VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);
}
Title: Re: Could someone help me make this work...
Post by: brianjw on December 07, 2008, 10:24:49 PM
Ok, thank you. :) That does I guess what it is supposed to do. It updates BOTH forums when it is recounted on one of them.

Could you code something where if a new member registers on one site, the member count goes up on both forums?

Thanks. :)

Brian
Title: Re: Could someone help me make this work...
Post by: brianjw on December 21, 2008, 04:14:41 PM
BUMP
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on December 26, 2008, 09:04:23 AM
Quote from: brianjw on December 07, 2008, 10:24:49 PM
Ok, thank you. :) That does I guess what it is supposed to do. It updates BOTH forums when it is recounted on one of them.

Could you code something where if a new member registers on one site, the member count goes up on both forums?

Register function uses the same updateStats() function. So it should already be like that.
Title: Re: Could someone help me make this work...
Post by: MarkJ on December 27, 2008, 02:14:07 AM
      foreach ($changes as $key => $change)
      {
            db_query("
               REPLACE INTO prefix1_settings
               VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);

            db_query("
               REPLACE INTO prefix2_settings
               VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);
      }


How do you code this if you have more than 2 forums sharing the user database?
Title: Re: Could someone help me make this work...
Post by: brianjw on December 27, 2008, 11:41:56 AM
MarkJ, this is just a guess but I would think you just add more of this code after the other depending on how many forums you are sharing.

            db_query("
               REPLACE INTO prefix3_settings
               VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);


            db_query("
               REPLACE INTO prefix4_settings
               VALUES ('" . $key . "', '" . $change . "')", __FILE__, __LINE__);

Just change the prefixes to match to your forums and add them in the code. It's worth a try anyway. ;)
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on December 28, 2008, 03:59:03 AM
Yeah, that's it.

brianjw:

Could you get the issue solved or do you still require assistance?
Title: Re: Could someone help me make this work...
Post by: MarkJ on December 28, 2008, 06:12:47 AM
Seems to work fine!

I should have been able to work that out myself!

Cheers.
Title: Re: Could someone help me make this work...
Post by: brianjw on December 28, 2008, 10:59:24 AM
Blue Dream,

Thank you for asking. I still require assistance.

I have made that one code change you made here (http://www.simplemachines.org/community/index.php?topic=271586.msg1829413#msg1829413) but it still doesn't automatically update both sites stats. The two forums are sharing just the members so the members should be updating automatically on both forums when someone registers on either site. Currently, it just makes it so that when you run the Maintenance, it updates both forums instead of the one you're on right then. Do you think you can modify something a bit to be able to automatically update members on both forums? Thank you.

Brian
Title: Re: Could someone help me make this work...
Post by: [SiNaN] on January 07, 2009, 09:28:11 AM
In which forum files did you make the change? Does it the same for registrations from both forums?
Title: Re: Could someone help me make this work...
Post by: brianjw on January 07, 2009, 04:35:36 PM
I think. I combined the sites together using this tutorial: http://www.simplemachines.org/community/index.php?topic=16190.0
which tells me to modify ALL the Sources files so I did.
Title: Re: Could someone help me make this work...
Post by: azn_romeo_4u on May 18, 2009, 06:31:32 PM
Anyone found the solution to this yet? 

Do you update all forums with the code or just your sub forums, aka not the main forum.

Also are you suppose to use it with this mod?

http://www.simplemachines.org/community/index.php?topic=16190.msg690178#msg690178
Title: Re: Could someone help me make this work...
Post by: N3RVE on May 19, 2009, 08:05:33 PM
Is this issue solved or do you still require assistance?

-[n3rve]
Title: Re: Could someone help me make this work...
Post by: brianjw on May 20, 2009, 04:03:20 PM
I personally no longer require assistance because I am no longer working on this, however it looks like someone else requires assistance:
Quote from: azn_romeo_4u on May 18, 2009, 06:31:32 PM
Anyone found the solution to this yet? 

Do you update all forums with the code or just your sub forums, aka not the main forum.

Also are you suppose to use it with this mod?

http://www.simplemachines.org/community/index.php?topic=16190.msg690178#msg690178
Title: Re: Could someone help me make this work...
Post by: j4r3k on April 01, 2010, 06:17:01 AM
Solution:
http://www.simplemachines.org/community/index.php?topic=16190.msg2564370#msg2564370

p.s. maybe you should change the topic title.