News:

Wondering if this will always be free?  See why free is better.

Main Menu

Could someone help me make this work...

Started by brianjw, October 31, 2008, 04:08:32 PM

Previous topic - Next topic

brianjw

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.

N3RVE

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]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

brianjw

[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

brianjw


[SiNaN]

Edit the updateStats() function in Subs.php in the same way. Only the 'member' case but.
Former SMF Core Developer | My Mods | SimplePortal

brianjw

Thanks [SiNaN], now known as Blue Dream. :)

I will try it, and let you know how it goes.

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

brianjw

Sorry, haven't tested it yet. I will be testing it tonight.

brianjw

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

brianjw


brianjw


[SiNaN]

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__);
}
Former SMF Core Developer | My Mods | SimplePortal

brianjw

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

brianjw


[SiNaN]

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.
Former SMF Core Developer | My Mods | SimplePortal

MarkJ

      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?

brianjw

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. ;)

[SiNaN]

Yeah, that's it.

brianjw:

Could you get the issue solved or do you still require assistance?
Former SMF Core Developer | My Mods | SimplePortal

MarkJ

Seems to work fine!

I should have been able to work that out myself!

Cheers.

brianjw

Blue Dream,

Thank you for asking. I still require assistance.

I have made that one code change you made here 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

Advertisement: