If someones need a challenge, I would really like to have a mod that let me have multiple forums.
The best would be to have multiple instances of SMF, but using the same member database.
Could be done as long as on same server in same database just having different prefixes.
You would just do a replacement on smf_members table prefix_ with the main members table of forum that you are using. Would like modifying the smf database files.
Quote from: vbgamer45 on March 09, 2022, 04:07:53 PMCould be done as long as on same server in same database just having different prefixes.
You would just do a replacement on smf_members table prefix_ with the main members table of forum that you are using. Would like modifying the smf database files.
So I would install a new instance of smf, but use the same database as the 1st instance to install it, but with a different prefixes. For example, if the 1st instances prefix is "SMF1", I use "SMF2" for the second installation. Once installed, I would go change the SMF2 _members table prefix to SMF1 _members.
It this is it, than I should be able to do it myself. :-D
This exists for 2.0.x in the mod section
https://www.simplemachines.org/community/index.php?topic=575102.0
Quote from: Diego Andrés on March 09, 2022, 06:16:30 PMhttps://www.simplemachines.org/community/index.php?topic=575102.0
So if I have two instances of the new SMF 2.1 version, I can use this script?
That merges two forums together into one forum.
Ok. This is not what I want to accomplish. I want two distincts forum with their own themes but sharing the same members' list.
Quick dirty untested
Sources/Subs-Db-mysql.php
find
function smf_db_query($identifier, $db_string, $db_values = array(), $connection = null)
{
global $db_cache, $db_count, $db_connection, $db_show_debug;
global $db_unbuffered, $db_callback, $modSettings;
// Comments that are allowed in a query are preg_removed.
static $allowed_comments_from = array(
'~\s+~s',
'~/\*!40001 SQL_NO_CACHE \*/~',
'~/\*!40000 USE INDEX \([A-Za-z\_]+?\) \*/~',
'~/\*!40100 ON DUPLICATE KEY UPDATE id_msg = \d+ \*/~',
);
static $allowed_comments_to = array(
' ',
'',
'',
'',
);
// Decide which connection to use.
$connection = $connection === null ? $db_connection : $connection;
add after
global $db_prefix;
$db_string = str_replace("{db_prefix}members","yourmaindbprefix_members",$db_string);
Replace yourmaindbprefix_members with the members table prefix of your main table.
The multi forum mod does exactly that....
Multiple forums on separate subdomains, choice for boards to be shared between subgroups or separate. User list is shared but can have access based on permission groups.
I THINK it can do different themes
Found it
https://custom.simplemachines.org/index.php?mod=2137
I
Oups. Something went wrong with my previous post. ;-)
So here is what I wanted to post.
I will try both approach.
Question.
How different is 2.1 versus 2.0?
I am under the impression that most mods in 2.0 will not work on 2.1. Is this a false impression?
Quote from: DenDen60 on March 10, 2022, 07:45:24 AMI am under the impression that most mods in 2.0 will not work on 2.1. Is this a false impression?
Yes.... The more in-depth the mod, the less chance that it will work without further modification.
Mods which are "hooks only" are likely to work with little problem - mods with file edits are possibly going to encounter errors, depending on how old the mod is (php version dependent code, especially)
Quote from: vbgamer45 on March 09, 2022, 08:59:48 PMadd after
Code Select Expand
global $db_prefix;
$db_string = str_replace("{$db_prefix}members","yourmaindbprefix_members",$db_string);
Replace yourmaindbprefix_members with the members table prefix of your main table.
Hence if
- My 1st members table name is: smfla_members , and
- my 2nd community is : smfez_members
I change my 2nd community table name to
smfla_membersThus a member of community 1 will be able to access the community 2 and vice versa?
Should be able to if you make the change on 2nd community is : smfez_members
The 2nd community's member table will be ignored. So if they were a member on smfez_members but not on smfla_members then they would need to reregister.
Quote from: vbgamer45 on April 30, 2022, 08:46:24 AMShould be able to if you make the change on 2nd community is : smfez_members
The 2nd community's member table will be ignored. So if they were a member on smfez_members but not on smfla_members then they would need to reregister.
OK, just to be clear. I have my main forum already in place. I am creating a new one. Hence there are no members in this second community.
By making the changes, all existing members of the community 1 will have access to community 2.
Any new members, whether they register through community 1 or community 2, will have access to both community.
Do I understand this properly?
Yes that's how it should work.
OK I inserted this code:
global $db_prefix;
$db_string = str_replace("{$db_prefix}members","smfla_members",$db_string);
It did not work.
I then try this, just in case, but it didn't work either.
global $db_prefix;
$db_string = str_replace("{$db_prefix}members","smfla",$db_string);
My question is the following, shouldn't I give the complete path to the database?
Let us say that the first data base is
user1_smf300_smfla_members
and the second one is
user1_smf301_smfEP_members,
should I point to user1_smf300_smfla_members for it to work?
Don't let them upload avatars.
If its a separate database then you have to add the database in front of it such as below. The period seperates the db name and the table
$db_string = str_replace("{db_prefix}members","databasename.smfla_members",$db_string);
Also you must check that your db user has permission to access both databases
Ok I have done this:
global $db_prefix;
$db_string = str_replace("{$db_prefix}members","user_smf300.smfla_members",$db_string);
and this
global $db_prefix;
$db_string = str_replace("{$db_prefix}members","smf300.smfla_members",$db_string);
But I don't see the members when I check in member list.
I even tried to log in with one of the user of the 1st forum to the 2nd forum, but it did not work.
Attach your file you are editing.
And note Arantor's on avatars for upload. Issue is attachments table not shared
Here it is, Subs-Db-mysql.php
Visit member list after uploading the file then check error log.
I want to see what it says for prefix. Added logging.
Quote from: vbgamer45 on April 30, 2022, 11:41:41 AMVisit member list after uploading the file then check error log.
I want to see what it says for prefix. Added logging.
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=logs;sa=errorlog;desc;filter=error_type;value=database
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Doesn't say anything else.
Try this instead.
There are 5 errors. (There were 5 prior as well, but they all seemed to be the same. Do you want me to reload the previous version and copy the errors here?)
Guest
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=logs;sa=errorlog;desc=
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Backtrace information
Type of error: General
Error message Select
Prefix: smfez_ String:
SELECT mem.*, COALESCE(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type, a.width AS "attachment_width", a.height AS "attachment_height"
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = {int:id_member})
WHERE mem.id_member = {int:id_member}
LIMIT 1
----
admin_Test_1!
70.53.170.194
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Prefix: smfez_ String:
REPLACE INTO smfez_sessions(`session_id`, `data`, `last_update`)
VALUES
('e111a20387cff357ec6f009df5f241f4', 'a:14:{s:13:\"session_value\";s:32:\"c09c515b53892b635e03e4be802ce066\";s:11:\"session_var\";s:8:\"a8a7ba6c\";s:5:\"token\";a:4:{s:11:\"post-remind\";a:4:{i:0;s:10:\"fac5baf01a\";i:1;s:32:\"ed880e631ca2456ca43cd7cd01acf18e\";i:2;i:1651334026;i:3;s:32:\"13bd277f9736d008fa57006f01c22ffd\";}s:10:\"post-login\";a:4:{i:0;s:9:\"d54c3da02\";i:1;s:32:\"f9d9b7eca20cbd0575067fc61558a349\";i:2;i:1651334039;i:3;s:32:\"638652f4d9aa2db86ef4fff2f8e659dc\";}s:16:\"post-admin-login\";a:4:{i:0;s:11:\"ac04de2ee81\";i:1;s:32:\"896c83553d21cd1bd2b7d5ecfd337eb0\";i:2;i:1651338787;i:3;s:32:\"c30abe731ffc80bbbb8319f805519713\";}s:13:\"post-admin-el\";a:4:{i:0;s:12:\"d6f2c9901574\";i:1;s:32:\"b01beb5a4d478fa71e51527f22c5201d\";i:2;i:1651338789;i:3;s:32:\"222581b911eedcf04e4d68d2cf074863\";}}s:2:\"mc\";a:7:{s:4:\"time\";i:1651334040;s:2:\"id\";i:1;s:2:\"gq\";s:3:\"1=1\";s:2:\"bq\";s:3:\"1=1\";s:2:\"ap\";a:1:{i:0;i:0;}s:2:\"mb\";a:0:{}s:2:\"mq\";s:3:\"0=1\";}s:3:\"ban\";a:5:{s:12:\"last_checked\";i:1651334039;s:9:\"id_member\";i:0;s:2:\"ip\";s:13:\"70.53.170.194\";s:3:\"ip2\";s:13:\"70.53.170.194\";s:5:\"email\";s:0:\"\";}s:8:\"log_time\";i:1651338946;s:17:\"timeOnlineUpdated\";i:1651338946;s:7:\"old_url\";s:119:\"https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066\";s:10:\"USER_AGENT\";s:78:\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0\";s:18:\"login_SMFCookie854\";s:173:\"{\"0\":1,\"1\":\"25e84ad2390dae21e7ed5cb183011225ea80bfc651d21ad08d01eabbee15f29b630f0a5c3a6b2b8a69832991cd2ec836805f3fee8930f7ddf154f5b00f8fdbf8\",\"2\":1840550040,\"3\":\"\",\"4\":\"\\/\"}\";s:17:\"id_msg_last_visit\";s:1:\"1\";s:2:\"rc\";a:4:{s:2:\"id\";i:1;s:4:\"time\";i:1651334040;s:7:\"reports\";s:1:\"0\";s:14:\"member_reports\";s:1:\"0\";}s:15:\"unread_messages\";i:0;s:10:\"admin_time\";i:1651338789;}', 1651338946)
----
Prefix: smfez_ String:
REPLACE INTO smfez_sessions(`session_id`, `data`, `last_update`)
VALUES
('e111a20387cff357ec6f009df5f241f4', 'a:14:{s:13:\"session_value\";s:32:\"c09c515b53892b635e03e4be802ce066\";s:11:\"session_var\";s:8:\"a8a7ba6c\";s:5:\"token\";a:4:{s:11:\"post-remind\";a:4:{i:0;s:10:\"fac5baf01a\";i:1;s:32:\"ed880e631ca2456ca43cd7cd01acf18e\";i:2;i:1651334026;i:3;s:32:\"13bd277f9736d008fa57006f01c22ffd\";}s:10:\"post-login\";a:4:{i:0;s:9:\"d54c3da02\";i:1;s:32:\"f9d9b7eca20cbd0575067fc61558a349\";i:2;i:1651334039;i:3;s:32:\"638652f4d9aa2db86ef4fff2f8e659dc\";}s:16:\"post-admin-login\";a:4:{i:0;s:11:\"ac04de2ee81\";i:1;s:32:\"896c83553d21cd1bd2b7d5ecfd337eb0\";i:2;i:1651338787;i:3;s:32:\"c30abe731ffc80bbbb8319f805519713\";}s:13:\"post-admin-el\";a:4:{i:0;s:12:\"d6f2c9901574\";i:1;s:32:\"b01beb5a4d478fa71e51527f22c5201d\";i:2;i:1651338789;i:3;s:32:\"222581b911eedcf04e4d68d2cf074863\";}}s:2:\"mc\";a:7:{s:4:\"time\";i:1651334040;s:2:\"id\";i:1;s:2:\"gq\";s:3:\"1=1\";s:2:\"bq\";s:3:\"1=1\";s:2:\"ap\";a:1:{i:0;i:0;}s:2:\"mb\";a:0:{}s:2:\"mq\";s:3:\"0=1\";}s:3:\"ban\";a:5:{s:12:\"last_checked\";i:1651334039;s:9:\"id_member\";i:0;s:2:\"ip\";s:13:\"70.53.170.194\";s:3:\"ip2\";s:13:\"70.53.170.194\";s:5:\"email\";s:0:\"\";}s:8:\"log_time\";i:1651338946;s:17:\"timeOnlineUpdated\";i:1651338946;s:7:\"old_url\";s:119:\"https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066\";s:10:\"USER_AGENT\";s:78:\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0\";s:18:\"login_SMFCookie854\";s:173:\"{\"0\":1,\"1\":\"25e84ad2390dae21e7ed5cb183011225ea80bfc651d21ad08d01eabbee15f29b630f0a5c3a6b2b8a69832991cd2ec836805f3fee8930f7ddf154f5b00f8fdbf8\",\"2\":1840550040,\"3\":\"\",\"4\":\"\\/\"}\";s:17:\"id_msg_last_visit\";s:1:\"1\";s:2:\"rc\";a:4:{s:2:\"id\";i:1;s:4:\"time\";i:1651334040;s:7:\"reports\";s:1:\"0\";s:14:\"member_reports\";s:1:\"0\";}s:15:\"unread_messages\";i:0;s:10:\"admin_time\";i:1651338789;}', 1651338946)
----
admin_Test_1!
70.53.170.194
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Backtrace information
Type of error: General
Error message Select
Prefix: smfez_ String:
SELECT id_member, alert_pref, alert_value
FROM {db_prefix}user_alerts_prefs
WHERE id_member IN ({array_int:members})
AND alert_pref IN ({array_string:prefs})
----
admin_Test_1!
70.53.170.194
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Backtrace information
Type of error: General
Error message Select
Prefix: smfez_ String:
SELECT
mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.member_ip, mem.member_ip2, mem.last_login,
mem.posts, mem.is_activated, mem.date_registered, mem.id_group, mem.additional_groups, mg.group_name
FROM {db_prefix}members AS mem
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)
WHERE 1=1
ORDER BY {raw:sort}
LIMIT {int:start}, {int:per_page}
----
admin_Test_1!
70.53.170.194
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;sa=all;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 389)
Backtrace information
Type of error: General
Error message Select
Prefix: smfez_ String:
SELECT COUNT(*) AS total_members, is_activated
FROM {db_prefix}members
WHERE is_activated != {int:is_activated}
GROUP BY is_activated
Ah, I see the replacement didn't happen yet.
Try this file.
I guet this error message
SELECT command denied to user 'citize47_smf300'@'localhost' for table 'smfla_members'
You need to give permission in your database for db user citize47_smf300 to the smfla_members table or the database that it is under.
Hummm! The database user is the same for both databases. I did make sure that the database user had access to both databases.
It shouldn't have that error message. If not make a new user and put in both settings config.
The problem is that I have to reinstall the older version of the file, because I have not access to SMF at this time.
So I reinstall the 1st version you sent me and this time there seems to be only 2 errors instead of 5. (This may be due to the fact that I have given the required permission to the database_user.
Guest
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Load.php (Line 561)
Backtrace information
Type of error: Database
Error message Select
: SELECT command denied to user 'citize47_smf300'@'localhost' for table 'smfla_members'
Guest
c09c515b53892b635e03e4be802ce066
https://www.societalogy.org/EZ/index.php?action=admin;area=viewmembers;a8a7ba6c=c09c515b53892b635e03e4be802ce066
/home/citize47/public_html/societalogy.org/EZ/Sources/Subs-Db-mysql.php (Line 594)
Backtrace information
Type of error: General
Error message Select
8: Trying to access array offset on value of type null
The first version won't work though since the db_prefix is replaced later on. The latest file is the one that should be used. And will work if the database permissions are set correctly.
Quote from: vbgamer45 on April 30, 2022, 02:52:58 PMThe first version won't work though since the db_prefix is replaced later on. The latest file is the one that should be used. And will work if the database permissions are set correctly.
OK. I will verify again, but all the boxes were checked, so in theory the database user should have access to both databases. I will do this later today. Thanks for your help.
OK, I checked to make sure that I had the right DB_Admin Username for both Instances of SMF and I had the right passwords. There is only one DB_Admin Username and only one password.
I then check to see if the DB_Admin Username has access to all the privileges to both instances and it has. This is actually normal since I use the same DB_Admin Username to install the two instances of SMF.
After I have done all this, I replace Subs-Db-mysql.php with the last version below, but the error message is still there:
SELECT command denied to user 'citize47_smf300'@'localhost' for table 'smfla_members'
Question, what does " command denied to user " do ?
Its actually the "SELECT" statement in mysql. It allows you to read a database table.
I need someone to develop a multi-forum mod. Anyone interested. I do have access to a small budget for this.
the member profile would be the same for all forums and include a few fields including country, state and city, which comes from https://simplemaps.com/data/world-cities.