Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Pedja on May 15, 2007, 11:34:41 AM

Title: Multidomain SMF forum
Post by: Pedja on May 15, 2007, 11:34:41 AM
I needed modification of a forum to allow me to run several separate forums on top of the one instalation of SMF forum, with regeuest that whole database should be shared too.

The whole idea was that I can run several virtual forums under different domains but also run one general forum that offers contents fo all virtual forums and some more.

I've done some modifications that do what I needed so here it is:


SMF MULTIDOMAIN MOD
Description:

This mod allows you to have several forums on single board instalation. Each forum is located on separate

domain, and all forums share the same databse od messages, users and setings. You can customize look of each

forum and also choose which categories and boards should be visible in each domain.

Features:

- supports unlimited number of forums
- each forum uses separate domain. Domains can be unrelated or subdomains of the same top domain
- each forum can show configurable categories or boards of the main forum. This means you may have lots of

boards on forum but show just one category, or just one board for specific forum.
- each board can be shown or hidden on any forum
- each category can be shown or hidden on any forum
- each forum can use different template, so you can independently customize each forum look
- each forum can use different logo if you do not need to change complete look
- each forum can have different forum name
- each forum can have different HTML description
- each forum can have different HTML keywords
- last unread posts, new replies, search andother forum functions that should be affected by domain filter, are

affected
- mod does not change SMF tables, just adds one independent table for it's configuration
- mod is implemented on SMF 1.1 RC3 but it should be aplicable to any 1.x version


How to do modification:

This may look as lots of work but actualy it is not. It would be easier if this mod is realised aspackagebut I

do not know how to createpackage. If anyone is willing to makepackageof this, that would be great.


- park new domain on top of the primary forum domain. Make sure, that, when you open new domain in browser you

get working forum. note that all links on forum stil point to priamry domain.


- change seetitngs.php to force SMF to use current domain for all links:


open Settings.php

find



$boardurl = '



the rest of the line would be the already set (primary) domain

comment that line (put // as the very first in the line) and add new line below:



$boardurl = 'http://' . $_SERVER['HTTP_HOST'];




Now reload forum on new domain (not primary) and check if all links point to it domain

That is fixed


Create table smf_domain_forums in forum database. Pay antention to table prefix if you do not use default smf_

prefix.



CREATE TABLE `smf_domains` (
`domain_id` smallint(5) unsigned NOT NULL auto_increment,
`domain` varchar(35) NOT NULL default '',
`categories_show` varchar(35) NOT NULL default '',
`categories_hide` varchar(35) NOT NULL default '',
`boards_show` varchar(35) NOT NULL default '',
`boards_hide` varchar(35) NOT NULL default '',
`THEME_ID` tinyint(4) default NULL,
`header_logo_url` varchar(35) default NULL,
`forum_name` varchar(35) character set utf8 default NULL,
`keywords` text character set utf8,
`description` text character set utf8,
`wellcome` text character set utf8,
PRIMARY KEY (`domain_id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;




Insert at least one record in this table. Fields domain, categories_show, categories_hide, boards_show, and

boards_hide must not be NULL.



INSERT INTO smf_domains (domain, categories_show, categories_hide, boards_show, boards_hide, THEME_ID,

header_logo_url, forum_name, keywords, description) VALUES ('','','','','',NULL,NULL,NULL,NULL,NULL);



Domain match is set by filling domain field in record. It may apsolutely match requested domain but any substring match will do. Contents of domain field must be substring of host domain used for forum access. If several records match, the first one is used.

Now edit Sources/Load.php and at the bottom of the php code (just before ?> ) insert



// multidomain support
// load settings for current domain if it is customised for multidomain use
function loadDomain() {
global $db_prefix, $context;

$smf_domain = $_SERVER['HTTP_HOST'];

$query = "SELECT DISTINCT *
FROM

{$db_prefix}domain_forums
WHERE (INSTR('$smf_domain', domain) > 0)";

$request = db_query($query, __FILE__, __LINE__);

$row_domain = mysql_fetch_assoc($request);
mysql_free_result($request);

$context['custom_domain'] = $row_domain;
$m_row_domain = $row_domain['domain'];

$query = "
SELECT b.ID_BOARD, b.ID_CAT
FROM {$db_prefix}boards as b, {$db_prefix}domain_forums as df
WHERE df.domain = '$m_row_domain'
AND ( FIND_IN_SET(b.ID_CAT, df.categories_show) OR FIND_IN_SET(b.ID_BOARD,

df.boards_show) OR ((df.categories_show = '') AND (df.boards_show = '')) )
AND NOT (FIND_IN_SET(b.ID_CAT, df.categories_hide))
AND NOT (FIND_IN_SET(b.ID_BOARD, df.boards_hide))";
$request = db_query($query, __FILE__, __LINE__);

$boards_list = '';
$categories_list = '';

while ($line = mysql_fetch_assoc($request)) {
if (!empty ($boards_list)) $boards_list .= ',';
$boards_list .= $line['ID_BOARD'];
if (!empty ($categories_list)) $categories_list .= ',';
$categories_list .= $line['ID_CAT'];
}

mysql_free_result($request);

$context['custom_domain']['boards_list'] = $boards_list;
$context['custom_domain']['categories_list'] = $categories_list;


} // end loadDomain()


function customDomainConfiguraion() {
global $context, $settings;

//multidomain feature
//set custom domain header logo
if (! empty ($context['custom_domain']['header_logo_url'])) {
$settings['header_logo_url'] = $context['custom_domain']['header_logo_url'];
}
if (! empty ($context['custom_domain']['forum_name'])) {
$context['forum_name'] = $context['custom_domain']['forum_name'];
}
if (! empty ($context['custom_domain']['keywords'])) {
$context['keywords'] = $context['custom_domain']['keywords'];
}
if (! empty ($context['custom_domain']['description'])) {
$context['description'] = $context['custom_domain']['description'];
}

} // customDomainConfiguraion()






Now find function function loadUserSettings() in the same file. Find line



global $ID_MEMBER, $db_prefix, $cookiename, $user_info, $language;



and insert innext line this code



global $context;




Go to the last line of that funcion, and at the very bottom of function definition (just before } ) insert this




// multidomain feature
// set filter to boards to show only those that are attached to custom domain
// if(!isset($_REQUEST['action']) && !isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
if(!isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
$row_forumList = $context['custom_domain'];

$user_info['query_see_board'] .= ' AND FIND_IN_SET(b.ID_BOARD, "' .

$row_forumList['boards_list'] . '") ';

// $user_info['query_see_board'] .= ' AND (' ;
// $user_info['query_see_board'] .= (int) (empty($row_forumList['categories_show']) and

empty($row_forumList['boards_show'])) ;
// $user_info['query_see_board'] .= ' OR FIND_IN_SET(c.ID_CAT, "' .

$row_forumList['categories_show'] . '")';
// $user_info['query_see_board'] .= '  OR FIND_IN_SET(b.ID_BOARD, "' .

$row_forumList['boards_show'] . '") )';
// $user_info['query_see_board'] .= ' AND NOT (FIND_IN_SET(c.ID_CAT, "' .

$row_forumList['categories_hide'] . '")';
// $user_info['query_see_board'] .= ' OR FIND_IN_SET(b.ID_BOARD, "' .

$row_forumList['boards_hide'] . '"))';

}





Find function loadTheme and search for



// Wireless mode? Load up the wireless stuff.
if (WIRELESS)



and insert before that code



// multidomain feature
// adjust configuration according to custom domain settings
customDomainConfiguration();





Now, find



elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the forum's default.
else
$ID_THEME = $modSettings['theme_guests'];




and replace with


elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the domain's default.
elseif (! empty ($context['custom_domain']['THEME_ID'])) {
$ID_THEME = $context['custom_domain']['THEME_ID'];
} else
$ID_THEME = $modSettings['theme_guests'];




Open Sources/BoardIndex.php and find




AND b.childLevel <= 1" : ''), __FILE__, __LINE__);



replace it with



AND b.childLevel <= 1" : '') . " ORDER BY c.catOrder, b.boardOrder ASC" , __FILE__, __LINE__);




Open index.php

Find



// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();


and before that insert



//multidomain feature
//Load custom domain information
loadDomain();




Open Sources/Recent.php

Find function getLastPosts and within the first SQL query search for



WHERE m.ID_MSG >= " . max(0, $modSettings['maxMsgID'] - 20 * $showlatestcount) . "
AND t.ID_TOPIC = m.ID_TOPIC


Replace it with



WHERE t.ID_TOPIC = m.ID_TOPIC




Now you will have pretty functional forum for each domain.




ADDITION


Now, do you want option to change order of categories on additional domain? Let's do some more modifications.

First create new table



CREATE TABLE `smf_domain_categories` (
`domain_id` smallint(5) unsigned NOT NULL default '0',
`ID_CAT` tinyint(4) unsigned NOT NULL default '0',
`catOrder` tinyint(4) unsigned NOT NULL default '0',
`name` tinytext character set utf8,
PRIMARY KEY (`domain_id`,`ID_CAT`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



Check table smf_domains

It should have this field:

   `domain_id` smallint(5) unsigned NOT NULL auto_increment,

and primary key set to domain_id

   PRIMARY KEY (`domain_id`)

If the structure of the table smf_domains in your databse differs from the one provided on top of this document the best would be to recreate whole table. That would save you trouble of matching and updating differences (unfortunately, this modification is work in progress, so I had to change structure of the table)


Now, open Sources/BoardIndex.php and find




AND b.childLevel <= 1" : ''



Do you find it familiar? Right that's where we already made a change to get categories inorder. Now we have to change that SQL to get more. Go to the begining of SQL query and do this

Find



c.name



and replace it with



IFNULL(dc.name, c.name)



Find



ORDER BY c.catOrder



and replace it with

ORDER BY IFNULL(dc.catOrder, c.catOrder)



Also, after the last LEFT JOIN line in query insert new one

[code]

LEFT JOIN {$db_prefix}domain_categories as dc ON (dc.ID_CAT = c.ID_CAT) AND

(dc.domain_id = " . $context['custom_domain']['domain_id'] . ")



Now, this would work but domain dependant category name would not show everywhere. We have to find every place in code that shows c.name in query and do similar replacements. there is just one imortant place that should be fixed:

Open Load.php

Find c.name. It should occur two times. The First time it is ni function loadBoard().

Replace



c.name



and replace it with



IFNULL(dc.name, c.name)



and after the last LEFT JOIN line in the same SQL query insert new one



LEFT JOIN {$db_prefix}domain_categories as dc ON (dc.ID_CAT = c.ID_CAT) AND

(dc.domain_id = " . $context['custom_domain']['domain_id'] . ")




The second occurence fo the c.name is in function loadJumpTo(). You may do the same alteratin of the query here. That would fix name od category in Jump To compo box. I have this combo disabled so I did not care.


Now you have to populate table. Notice that now, each record in smf_domains has doman_id which must be unique

number. This number is used as referncein smf_domain_categories. When you want to set order of categories,

remembre domain_id from smf_domains for targeted domain and put it in domain_id in smf_domain_categories for

each category (ID_CAT) you want to set.

You may now set catOrder (order of the category) and name (name of the category that would be presented on

forum). Scripts works in that way that if tries to use category order and naem form smf_domain_categories table,

and if there is no setting the it would use setting from the main domain.




Note: This code has been updated.

You must notice that table name is changed form smf_domain_boards to smf_domains to match general table naming standards.

Also, structure of the table is changed a bit. Autoincrement field 'domain_id' is added, and PK changed to use this new field. Also, some character fields are set to UTF8 encoding.

Adition to this code is added do provide option to change order of categories and categories names based on used doman.

Attention:  

Althrough modification are not large and are quite simple and straightforward, please do not try to do this if you do not have some experience with PHP. Be sure to make backup of all scripts you are going try to change.

Note that in this modification I assumed you use default SMF table prefix. If you use different prefix, you should change table creation scripts accordingly.
[/code]
Title: Re: Multidomain SMF forum
Post by: KGIII on May 15, 2007, 04:52:26 PM
Nice post. Let me call attention to the rest of the team.
Title: Re: Multidomain SMF forum
Post by: KGIII on May 15, 2007, 06:30:18 PM
Move to tips and tricks. Enjoy.
Title: Re: Multidomain SMF forum
Post by: Pedja on May 17, 2007, 05:41:09 PM
No, this does the oposite: you install one SMF forum and then assign several domains to it and set which forums and categories may be seen on which domain. You may also set template and few other options for each domain.

At the end you have one SMF, one database, and unlimited number of forums that share the same user and message base but show just what they need.
Title: Re: Multidomain SMF forum
Post by: Thug life on May 18, 2007, 02:35:09 PM
Quote from: Pedja on May 17, 2007, 05:41:09 PM
No, this does the oposite: you instal one SMF forum and then assign several domains to it and set which forums and categories may be seen on which domain. YOu can slo set template and few other options for each domain.

At the end you have one SMF, one database, and unlimited number of forums that share the same user and message base but show just what they need.


Ahhh i think this is what this guy did, they are both the same forum but seperated between 2 domains

www.moparisthebest.com/smf www.moparscape.org/smf

Been like that for a while now, never noticed it
Title: Re: Multidomain SMF forum
Post by: mrperson13 on May 18, 2007, 08:16:24 PM
I did all this and then it came up with an error on line 149 of index.php.  That happens to be where loadDomain(); is.  Any idea what's wrong on my board?  I'm glad I backed everything up and fell back on the backup version because it didn't work.

I'm also not too great with php, and a lot of these steps assumed you know a lot about php.  In phpmyadmin I managed to complete all the steps sucessfuly (i think) but it was still a no go.



Also, look at what is said here.  It doesn't tell you what to open (about half way down the post)

Quote from: Pedja on May 15, 2007, 11:34:41 AM
Open Sources/BoardIndex.php and find




         AND b.childLevel <= 1" : ''), __FILE__, __LINE__);



replace it with



         AND b.childLevel <= 1" : '') . " ORDER BY c.catOrder, b.boardOrder ASC" , __FILE__, __LINE__);





Find



elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the forum's default.
else
$ID_THEME = $modSettings['theme_guests'];




and replace with


elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the domain's default.
elseif (! empty ($context['custom_domain']['THEME_ID'])) {
$ID_THEME = $context['custom_domain']['THEME_ID'];
} else
$ID_THEME = $modSettings['theme_guests'];
       




I found it, but I'm at work now and I forgot what file it was in.  It wasn't in boardIndex.php though.

I would really like to do this to my forum, but like I said I had problems with that line.  If someone could maybe re-write this and make it 'sound' a bit more simple that would be awesome.
Title: Re: Multidomain SMF forum
Post by: mrperson13 on May 18, 2007, 08:18:41 PM
By the way, as I stated before I'm kinda of new to php.   What I did was make a notepad file with this in it:

CREATE TABLE `osmf_domain_forums` (
  `domain` varchar(35) NOT NULL default '',
  `categories_show` varchar(35) NOT NULL default '',
  `categories_hide` varchar(35) NOT NULL default '',
  `boards_show` varchar(35) NOT NULL default '',
  `boards_hide` varchar(35) NOT NULL default '',
  `THEME_ID` tinyint(4) default NULL,
  `header_logo_url` varchar(35) default NULL,
  `forum_name` varchar(35) default NULL,
  `keywords` text,
  `description` text,
  PRIMARY KEY  (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO osmf_domain_forums (domain, categories_show, categories_hide, boards_show, boards_hide, THEME_ID, header_logo_url, forum_name, keywords, description) VALUES ('','','','','',NULL,NULL,NULL,NULL,NULL);


And renamed it to .sql then imported it to my database via phpmyadmin.  Was that right?
Title: Re: Multidomain SMF forum
Post by: Pedja on May 21, 2007, 06:44:05 AM
Quotemrperson13
I did all this and then it came up with an error on line 149 of index.php.  That happens to be where loadDomain(); is.  Any idea what's wrong on my board?  I'm glad I backed everything up and fell back on the backup version because it didn't work.

Wnat exact error showed up?

Indeed you have to make backup on each file before you start altrations.

Quote

I found it, but I'm at work now and I forgot what file it was in.  It wasn't in boardIndex.php though.


Quote
Find



elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the forum's default.
else
$ID_THEME = $modSettings['theme_guests'];




and replace with


elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the domain's default.
elseif (! empty ($context['custom_domain']['THEME_ID'])) {
$ID_THEME = $context['custom_domain']['THEME_ID'];
} else
$ID_THEME = $modSettings['theme_guests'];
&nbsp; &nbsp; &nbsp; &nbsp;




My mistake. This should be found an replaced in Load.php. I'll fix the first message where mod is explained.

Quote
And renamed it to .sql then imported it to my database via phpmyadmin.  Was that right?

Sure,  that is one way to do it.
Title: Re: Multidomain SMF forum
Post by: Pedja on May 21, 2007, 12:21:54 PM
I've updated modification instructions. There are some changes in previous code. Please not that, from now on, table smf_domain_boards is renamed to smf_domains

Also, I expanded modification with explanation how to change order and names of categories independently for each domain.

Title: Re: Multidomain SMF forum
Post by: mrperson13 on May 23, 2007, 12:14:54 AM
The error im getting is :

QuoteParse error: syntax error, unexpected ')' in /home/.funny/mrperson13/shatteredkingdom.org/Sources/Load.php on line 543

That line is:
$user_info['query_see_board'] .= ' AND FIND_IN_SET(b.ID_BOARD, "' .

Also, should all those &nbsp; be in your code?  I took them out and replaced them with the tab key after it didn't work, but that didn't solve the problem either.
Title: Re: Multidomain SMF forum
Post by: Pedja on May 23, 2007, 09:09:59 AM
here is part of the code around that line from my Load.php so check if you made all corrections:

Quote
   // multidomain feature
   // set filter to boards to show only those that are attached to custom domain
//   if(!isset($_REQUEST['action']) && !isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
   if(!isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
      if (!empty ($context['custom_domain'])) {
         $row_forumList = $context['custom_domain'];
         $user_info['query_see_board'] .= ' AND FIND_IN_SET(b.ID_BOARD, "' . $row_forumList['boards_list'] . '") ';
      } else {
         print '@@@ domain undefined @@@';
      }
   }

Those &nbsp; showed up when I pasted code. I did not notice them. You may just remove them, or replace with tabs, it does not matter.
Title: Re: Multidomain SMF forum
Post by: Pedja on May 29, 2007, 11:58:36 AM
I managed to improve this modification to allow admin to move board to another category on specific separate domain, and also to rename board for specific domain.

i stil have to do some work to solve child . parent relation among boards so it would alow even that to be changed for specific domain: one board could be child of another on one domain, and top level board on another.
Title: Re: Multidomain SMF forum
Post by: mdp on June 04, 2007, 08:40:56 PM
Pedja,
I have to ask you this if your step by step process is necessary when two domains are using one same webserver?

When I had phpbb2, all I had to do is change the setting of username and password then that took care of everything.  Pretty simple!  Your process seems more complex than phpbb2..

Title: Re: Multidomain SMF forum
Post by: Sarge on June 05, 2007, 03:53:43 AM
This mod is similar to one I wrote: Shared Forum Mod (http://www.simplemachines.org/community/index.php?topic=158330.0). But your mod features multiple domains support, which is nice. ;)
Title: Re: Multidomain SMF forum
Post by: mdp on June 05, 2007, 05:43:08 PM
Pedja,

I am getting error message

"Fatal error: Call to undefined function: loaddomain() in /home/thunder/public_html/index.php on line 147"
Title: Re: Multidomain SMF forum
Post by: Pedja on June 05, 2007, 06:07:39 PM
This error means, there is no loaddomain() function in Load.php

About similarity with phpBB - I guess it could not be easier to make this functionality with PHPBB, except if it already does not support multidomain feature.

If you just need the same forum to be seen under two different domains, that indeed is easy in SMF and I guess phpBB too. but, if you want forum to look differently, display different categories and subforums, change their order etc., then some extensive changes in code are necessary, as you can see mostly in SQL queries.

U guess it would be similar complexity to achieve the same functionality under phpBB. In SMF, it is actually simplified by the way how filtering is originally done.

Actually, all this changes are straightforward when you understand how it works.


Sarge, your mod is similar, you did the good work. But, it lacks some functionality I wanted. First, I wanted multidomain feature (and not support for portal), and then, I managed to find simpler way to make it work and provide more functions.
Title: Re: Multidomain SMF forum
Post by: mdp on June 05, 2007, 07:45:30 PM
Pedja,

Assume I want two separate websites to use one same forum, registered member, and picture gallery but not same TP and theme design then what would you recommend??  This is what I am trying to work on right now and I would appreciate some help..
Title: Re: Multidomain SMF forum
Post by: mdp on June 05, 2007, 07:50:41 PM
and actually there is loadDomain() at Source/load.php page just before the ?> so don't know why it is causing error message on index.php  I followed everything you said except for the "In Addition" part. 
Title: Re: Multidomain SMF forum
Post by: Sarge on June 06, 2007, 04:00:25 AM
Quote from: Pedja on June 05, 2007, 06:07:39 PM
Sarge, your mod is similar, you did the good work. But, it lacks some functionality I wanted. First, I wanted multidomain feature (and not support for portal), and then, I managed to find simpler way to make it work and provide more functions.

Would like to join forces with me? We could make a better mod out of the two. ;)

Regarding my mod, I fully plan to remove any requirement for TP (while providing support for it) and make the code more modular. I have already started on the next major version.
Title: Re: Multidomain SMF forum
Post by: Pedja on June 06, 2007, 08:22:53 AM
Quotemdp

... and actually there is loadDomain() at Source/load.php page ...


Pay attention that function is called loadDomain() and error shows that loaddomain() is missing. Missing function is named all in lower case.

Quotemdp
Assume I want two separate websites to use one same forum, registered member, and picture gallery but not same TP and theme design then what would you recommend??  This is what I am trying to work on right now and I would appreciate some help..

Well, I have no experience with TP, so I cannot tell. Point of my modification that all what is needed to make totaly different forun on top of already installed is to assing separate domain. When you access forum on any of the domains it would behave as totaly independednt and fully functional forum.

This means, you can change looks and contents but message and user base stays the same.

Go ahead and take look:

http://forum.uzice.net
http://oglasi.uzice.net
http://forum.vpts.uzice.net
http://forum.datavoyage.com
http://blog.forum.uzice.net/

That is all the same forum. It just behaves differently depending on domain.

If you can make two TP's to work with forums on separate domains (which I do not see why would not work), you would have no problems.

QuoteSarge

Would like to join forces with me? We could make a better mod out of the two.


Sure, why not?

Title: Re: Multidomain SMF forum
Post by: KGIII on June 06, 2007, 02:45:05 PM
This is really quite active for a tips/tricks post. I'm impressed.
Title: Re: Multidomain SMF forum
Post by: Pedja on June 06, 2007, 03:07:20 PM
Well, I also had plan to expand this idea to allow that it is possible to move board to different category than in main forum and alos i can change child status of a board so board that is child in main forum, does not have to be child in virtual forum.

Actually I managed to do that, and it works fine, but I am not that familiar with SMF code to find and fix all isues that follow. So I am a bit stuck.

This modification seems to go to deep to be easily done as mod. This should be done in the core installation.
Title: Re: Multidomain SMF forum
Post by: mdp on June 06, 2007, 04:40:11 PM
Long message erased as requested!
Title: Re: Multidomain SMF forum
Post by: Pedja on June 07, 2007, 01:19:56 AM
Ok, send me FTP access parameters, and url's of the forum, and erase these far too long messages here.
Title: Re: Multidomain SMF forum
Post by: mdp on June 09, 2007, 10:53:18 PM
ok Pedja,

I have done as you requested!  I re-created the forum using subdomain and the forum is now located at http://forum.thunderontobaccoroad.com/index.php

This time, I went through your process one step at time instead of trying to finish all of this at once and have hard time finding error.  Everything was going ok until I got stuck with table error.  I don't know why it is showing "Table 'thunder_smforum.smf_domain_forums' doesn't exist" when the table should be 'smf_domains' instead of 'smf_domains_forums'??
Title: Re: Multidomain SMF forum
Post by: mdp on June 09, 2007, 11:15:19 PM
Well, after tweaking with 'create table', it apparently that there are 2 tables to work with?  "domain_forums" and "domains_forums"  With both tables in phpMyAdmin, I was able to get page to load, but I am now getting:
QuoteFatal error: Call to undefined function: customdomainconfiguration() in /home/thunder/public_html/forum/Sources/Load.php on line 1399
Title: Re: Multidomain SMF forum
Post by: mdp on June 09, 2007, 11:23:52 PM
When I removed


// multidomain feature
// adjust configuration according to custom domain settings
customDomainConfiguration();


The forum page load up just fine!

Also, where am I supposed to assign the main domain to secondary domain using the installed smf database?  Is that in Settings.php under "Database Info"?  I might have overlooked your comment but I am not sure if you mentioned this or not??
Title: Re: Multidomain SMF forum
Post by: Pedja on June 13, 2007, 08:54:23 PM
Sorry, i was absent for few days so i could not respond. now iti s 3 am here so I am unable to think right.

On the first glance, tabel should be named domain_forums. If there is any reference to smf_domains_forums, that is type error. Replace it with smf_domain_forum.

You should not remove call to customDomainConfiguration() function. It is neccessary.

About making configuration:

You just have to popilate tables with apropriate data.

In smf_domains you set domains you want to handle (remmber, some fileds must not be null. If you want them empty, just type in somethng and then erase).

In smf_domain_categories you set order and eventualy rename categories
Title: Re: Multidomain SMF forum
Post by: pongsak on June 20, 2007, 02:51:22 AM
After follow every step, finally it errors as this.
1.
QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '​' at line 5
/home/med17/domains/med17.com/public_html/forum/Sources/Load.php
2475
Which i think it may be this part

$query = "SELECT DISTINCT *
FROM

{$db_prefix}domains
WHERE (INSTR('$smf_domain', domain) > 0)​";

$request = db_query($query, __FILE__, __LINE__);


No clue to correct it.
Don't know to do next. :(

2. When i copy your code from this page to edit in dreamwaver, i've not seen some special character inside inside  in some variable and it does errors always.But when i edit in noteplus , i see it  " ' " .

3. I think the code here is not correct
Quotefunction loadDomain() {
   global $db_prefix, $context;

   $smf_domain = $_SERVER['HTTP_HOST'];

   $query = "SELECT DISTINCT *
                                    FROM

{$db_prefix}domain_forums

it should not be {$db_prefix}domain_forums , but {$db_prefix}domains instead, there're 2 sites for this.
Title: Re: Multidomain SMF forum
Post by: Dejv on July 12, 2007, 12:02:27 PM
Quote from: Pedja on May 15, 2007, 11:34:41 AM



elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the forum's default.
else
$ID_THEME = $modSettings['theme_guests'];




and replace with


elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the domain's default.
elseif (! empty ($context['custom_domain']['THEME_ID'])) {
$ID_THEME = $context['custom_domain']['THEME_ID'];
} else
$ID_THEME = $modSettings['theme_guests'];




Hi :)

great mod, but there are lots of things I dont want.
- I just need the second, third,... forum to use different default templates, which are in different folders, so far they use different sources, ...
- forums are completly in different folders but on same server, they share one database.

I think I have to change something in this quote in Load.php, am I right?

It would be great if they could share language and images sources but thats not so necessary.

I need different templates for each domain because of googlemaps mod

Thanks a lot!

David

edit...

I've just changed

// Load a theme, by ID.
function loadTheme($ID_THEME = 0, $initialize = true)

to
// Load a theme, by ID.
function loadTheme($ID_THEME = 4, $initialize = true)

I hope this is right, but it works so far

4 is the copied default theme with right theme_url and theme_dir
Title: Re: Multidomain SMF forum
Post by: greyknight17 on July 28, 2007, 09:43:47 PM
David, yes, replace the first quote box code with what's said in the second one in the Load.php file.

For those who want to share the same database on two or more forums, take a look here (http://www.simplemachines.org/community/index.php?topic=16190.0).
Title: Re: Multidomain SMF forum
Post by: 911 on August 30, 2007, 07:07:39 PM
QuoteThis may look as lots of work but actualy it is not. It would be easier if this mod is realised aspackagebut I

do not know how to createpackage. If anyone is willing to makepackageof this, that would be great.

Any updates on this. Any chance to see a Mod Packadge for the guys who are not so familiar with php?

The Mod features sound awesome!

Thanks.
Title: Re: Multidomain SMF forum
Post by: falguni1 on December 18, 2007, 06:12:46 AM
important.
Title: Re: Multidomain SMF forum
Post by: capnken on January 01, 2008, 01:20:45 AM
Does this mod require mysql 4.1 or higher? The syntax for the 'smf_domains' table creation includes utf8, which gets kicked out in mysql 4.0. If there's a proper syntax for making that table in 4.0, I'd appreciate some help with that structure.

Mod worked great on a test site I set up (mysql 4.1), but porting everything over to my existing 4.0 forum gave me the table syntax errors and then the 'domain undefined' error when I took out the utf8 and latin1 parameters that made mysql 4.0 so angry.
Title: Re: Multidomain SMF forum
Post by: Sarge on January 04, 2008, 04:33:50 AM
Quote from: capnken on January 01, 2008, 01:20:45 AM
Mod worked great on a test site I set up (mysql 4.1), but porting everything over to my existing 4.0 forum gave me the table syntax errors and then the 'domain undefined' error when I took out the utf8 and latin1 parameters that made mysql 4.0 so angry.

I'm not sure about the "domain undefined" error, but I think the following table structure definitions should work for pre-4.1 versions of MySQL:

For the smf_domains table (previously called smf_domain_forums):

CREATE TABLE `smf_domains` (
`domain_id` smallint(5) unsigned NOT NULL auto_increment,
`domain` varchar(35) NOT NULL default '',
`categories_show` varchar(35) NOT NULL default '',
`categories_hide` varchar(35) NOT NULL default '',
`boards_show` varchar(35) NOT NULL default '',
`boards_hide` varchar(35) NOT NULL default '',
`THEME_ID` tinyint(4) default NULL,
`header_logo_url` varchar(35) default NULL,
`forum_name` varchar(35) default NULL,
`keywords` text,
`description` text,
`wellcome` text,
PRIMARY KEY (`domain_id`)
) ENGINE=MyISAM AUTO_INCREMENT=8;


For the smf_domain_categories table:

CREATE TABLE `smf_domain_categories` (
`domain_id` smallint(5) unsigned NOT NULL default '0',
`ID_CAT` tinyint(4) unsigned NOT NULL default '0',
`catOrder` tinyint(4) unsigned NOT NULL default '0',
`name` tinytext,
PRIMARY KEY (`domain_id`,`ID_CAT`)
) ENGINE=MyISAM;


It seems a change was forgotten. In the first change to Load.php, find this (it appears twice!) in function loadDomains():

{$db_prefix}domain_forums


and replace it with:

{$db_prefix}domains


I repeat, there are two places in the function where domain_forums appears. You have to replace both occurrences with domains.

I hope I haven't missed anything.
Title: Re: Multidomain SMF forum
Post by: capnken on January 04, 2008, 10:27:13 PM
Thanks, Sarge. I did end up getting the mod working and now I'm poking around with implementations. Challenge I'm working on now is making post/topic stats and user online information displays restrict themselves to the current domain. It'll be strange for users of the new Forum B see few posts and few users when it starts up and also see stats that say there are 100K posts, etc.
Title: Re: Multidomain SMF forum
Post by: Gwydion Frost on February 16, 2008, 01:27:15 AM
Pedja, Sarge...

You two really should integrate your mods into one super mod.

Seriously.
Title: Re: Multidomain SMF forum
Post by: cjexotic on February 17, 2008, 02:27:13 AM
QuoteYou two really should integrate your mods into one super mod.
I'd use that mod!

If  you guys could combine all that stuff as a mod and have it use TP
:o
Title: Re: Multidomain SMF forum
Post by: Sarge on February 17, 2008, 02:33:29 AM
Quote from: cjexotic on February 17, 2008, 02:27:13 AM
QuoteYou two really should integrate your mods into one super mod.
I'd use that mod!

If  you guys could combine all that stuff as a mod and have it use TP
:o

My mod uses TP already. ;)
Title: Re: Multidomain SMF forum
Post by: cjexotic on February 17, 2008, 02:46:25 AM
QuoteMy mod uses TP already.
Yeah I know I've been reading and rereading the thread on it.
Almost used it.
Liked it from your test forum

But I'm trying to use different domain names and their URLs  if possible.
Title: Re: Multidomain SMF forum
Post by: Sarge on February 17, 2008, 02:52:26 AM
Quote from: cjexotic on February 17, 2008, 02:46:25 AM
But I'm trying to use different domain names and their URLs  if possible.

I'll see what I can do about that. :)

Just don't hold your breath, though... I need to test and release another major beta version (0.3) that will use its own tables and support a (quite popular) mod for subforums. I'll see about subdomains after that.
Title: Re: Multidomain SMF forum
Post by: cjexotic on February 17, 2008, 03:25:28 AM
Cool

Appreciate it
Title: Re: Multidomain SMF forum
Post by: mdp on February 23, 2008, 11:02:56 AM
Okay,

When I first tried this tutorial and got this error message:
QuoteFatal error: Call to undefined function: loaddomain() in /home/wildhogs/public_html/index.php on line 145

I still can not understand why I am getting this message.  I followed exactly what was instructed and not get much of help here so I gave up and went on to do my own integration and was success.  That is until I purchased SMF Gallery Pro and that totally changed everything.  Things got screwed.  Now I can not go back to same way because I don't really remember how it was done because SMFHacks changed it few months ago and didn't tell me.  Oh well, such is life!

So now I am back to this again and now guess what?  Again, I followed instruction and again I am getting same error message:

QuoteFatal error: Call to undefined function: loaddomain() in /home/wildhogs/public_html/index.php on line 145

How can loaddomain() and loadDomain() be different??  Unless I am blind, I don't find any loaddomain() in the code :D

Also, where am I supposed to add the smf_domain_forums database into?  The primary or the secondary?

Just an idea??  How about just attaching the files where modification are changed for 1.1.4?  1 for simple mods and another for the whole including changing categories and etc.  So I can go ahead and upload the files overwritting existing one.  If you do, just add it to the first post of this thread.  Thanks!
Title: Re: Multidomain SMF forum
Post by: capnken on March 23, 2008, 10:50:55 AM
Hey guys - running Pedja's Multidomain and loving it. Absolutely great mod.

And now I'm in to tweaking out some fairly minor conflicts. And one of those is Calendar display of upcoming events. I show them on home pages and unread posts pages. The issue is that when somebody puts an event in a board that's restricted to Site A and also puts the event in a board that's restricted to Site B, it shows up twice in the home page upcoming events listing.

The duplicate events do not show up in the full calendar display, only in the upcoming events display on the home page and unread posts.

So what I need to do is also restrict calendar display in the upcoming events by the boards associated with the site. I've poked around different source files and can't figure out what's controlling the display on the full calendar and/or how to implement that on the display of upcoming events.

Any advice is appreciated.
Title: Re: Multidomain SMF forum
Post by: mdp on March 23, 2008, 11:21:33 AM
he doesn't reply to my post so I guess no need for me to subscribe anymore..
Title: Re: Multidomain SMF forum
Post by: perplexed on April 03, 2008, 12:09:39 PM
can someone show me some examples of this working?

What I want to do is mirror one of my forums so that it is accessible from different domain addresses (rather than just a link to the forum on one domain)

For example if the forum I wanted to mirror was http://www.fishingsite.com/forum

It would then appear as

http://www.fishingsite.com/forum   
http://www.huntingsite.com/forum
http://www.birdwatching.com/forum

It would all be the same forum but when you were in it, it would have the address for each domain as above, rather than being a redirect to http://www.fishingsite.com/forum on each different domain.

We do this at work, have the same site but one is in the US .com and mirrored on .co.uk so it that what this will do?

Title: Re: Multidomain SMF forum
Post by: SleePy on April 03, 2008, 09:46:15 PM
I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything.

But I assume you mean things like these?
http://lordsofclantribe.com/index.php
http://www.lordsofclantribe.com/
http://brainstemgames.com/community/ (Note that after some time this link will not truely work due to changes we are doing).

I got more links. But those are the most common ones I remember off the top of my head.

What I did is in my Settings.php I have an array of valid domains.
I then set a default url (the first one I linked) under $boardurl_default.
Then I check to see if we are using a valid domain. If we are I replace out the default boardurl with the new one.
I repeated this same step in Load.php for my ModSettings and Settings so my theme urls change as well.
Title: Re: Multidomain SMF forum
Post by: Sarge on April 04, 2008, 01:54:10 AM
Quote from: SleePy on April 03, 2008, 09:46:15 PM
I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything.

It's not there yet :) My mod allows you to run one forum, but make it look like several forums, using a single domain. I plan to add a moultidomain feature in later versions.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 04, 2008, 05:59:14 AM
Quote from: SleePy on April 03, 2008, 09:46:15 PM
I am not sure if Sarges mod is quite what you are looking for. His mod allows you to run multiple forums under multiple domains from a single SMF install using the same database and everything. 

Not quite there yet, I already checked with him

Quote from: SleePy on April 03, 2008, 09:46:15 PM
But I assume you mean things like these?
http://lordsofclantribe.com/index.php
http://www.lordsofclantribe.com/
http://brainstemgames.com/community/ (Note that after some time this link will not truely work due to changes we are doing).

Yes that looks like what I want to achieve :)

Quote from: SleePy on April 03, 2008, 09:46:15 PM
What I did is in my Settings.php I have an array of valid domains.
I then set a default url (the first one I linked) under $boardurl_default.
Then I check to see if we are using a valid domain. If we are I replace out the default boardurl with the new one.
I repeated this same step in Load.php for my ModSettings and Settings so my theme urls change as well.

So you didn't use the info in first post of this thread?  Can you give me more details please on how to set this up how you did it?  It sounds simpler but that might be me not understanding it.  I'd like to try it out.

Thanks Sleepy!

Title: Re: Multidomain SMF forum
Post by: perplexed on April 07, 2008, 11:15:12 AM
any more info or help with this?

Thanks

Title: Re: Multidomain SMF forum
Post by: SleePy on April 07, 2008, 12:50:23 PM
oh sorry. I keep forgetting to do this when I am at home.. I will email this to myself and get it tonight.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 07, 2008, 02:21:32 PM
thanks very much!  If you could make it 'for dummies' that would be even better lol
Title: Re: Multidomain SMF forum
Post by: SleePy on April 07, 2008, 09:37:37 PM
Ok..

In another file I have an array of domains, but they could be in your settings.php I have them in another file so other parts of my site can take advantage of the multiple urls as well easier.

$domains = array(
'lordsofclantribe.com' => false,
'brainstemgames.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


Well in my Settings.php In place of my $boardurl I did:
$boardurl = 'http://lordsofclantribe.com';
$boardurl_default = $boardurl;
if (isset($Site['domains'][$_SERVER['HTTP_HOST']]) && substr($_SERVER['HTTP_HOST'], -20) != $boardurl_default)
    $boardurl = 'http://' . $_SERVER['HTTP_HOST'] . '/community';


Then in Load.php at the end of the loadTheme function I added:

    global $Site, $boardurl_default;
    if (isset($Site['domains'][$_SERVER['HTTP_HOST']]))
    {
        $sub_folder = '';
        if (substr($_SERVER['HTTP_HOST'], -20) == $boardurl_default)
            $sub_folder = '/community/';

        foreach($settings as $key => $value)
            $settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);

        foreach($modSettings as $key => $value)
            $modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);
    }


Edit as needed :)
Title: Re: Multidomain SMF forum
Post by: perplexed on April 08, 2008, 05:32:37 AM
thanks sleepy I'll go try this out.


edited:  Ok I think I did it right but I guess not.  I have an 'undefined variable notice' at the top of my original forum which points to the domain code I put in settings.php (the part you have in a separate file)


I have an internal server error on one of the mirror urls and a 'nothing found' on the third one

Can I check, if you were going to put the domains array file into the settings file how would you do it?

Also can I check exactly where you put the third bit of code in load/php.  I may have it in the wrong place, I wasn't sure where function load theme ended, there's a lot in there.

Do I have to do anything on the other two additional domains to make this work?


Just to make sure...

my original forum (the one I want mirrored) is at http://www.domain1.com/forum

I have two more domains which have wordpress installed in the root and nothing else there

http://www.domain2.com
http://www.domain3.com

I would like when you got to url http://www.domain2.com/forum and http://www.domain3.com/forum that it would take you to the original forum but display the URL as domain2 or domain3 forum address and not http://www.domain1.com/forum
Title: Re: Multidomain SMF forum
Post by: SleePy on April 09, 2008, 01:21:30 AM
What code was on that line that had the error?

As for the load theme
You can tell where it ends because it does
}

function xxxx ([...])
{

And starts on the next function.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 09, 2008, 05:33:50 AM
It was this line

$domains['www.' . $dom] = $enable;

Notice:  Undefined variable: enable in /home/domain1/public_html/forum/Settings.php on line 39 

I added it like this before the forum info

########## Domain Info ##########
$domains = array(
'domain1.com' => false,
'domain2.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


I'll try it again this morning (see above, tried got same prob, but I'm probably not doing it right)

My original forum I wanted mirrored is http://www.domain1.com/forum

I want it to be mirrored at

http://www.domain2.com/forum
http://www.domain3.com/forum

Both domain2 and domain3 have wordpress installed in root and nothing else so far.
Title: Re: Multidomain SMF forum
Post by: Paracelsus on April 09, 2008, 05:45:07 AM
Quote from: SleePy on April 07, 2008, 09:37:37 PM
Ok..

In another file I have an array of domains, but they could be in your settings.php I have them in another file so other parts of my site can take advantage of the multiple urls as well easier.

$domains = array(
'lordsofclantribe.com' => false,
'brainstemgames.com' => true,
);

// Enables www urls.
foreach ($domains as $dom => $enable_www)
    if ($enable_www)
        $domains['www.' . $dom] = $enable;


Well in my Settings.php In place of my $boardurl I did:
$boardurl = 'http://lordsofclantribe.com';
$boardurl_default = $boardurl;
if (isset($Site['domains'][$_SERVER['HTTP_HOST']]) && substr($_SERVER['HTTP_HOST'], -20) != $boardurl_default)
    $boardurl = 'http://' . $_SERVER['HTTP_HOST'] . '/community';


Then in Load.php at the end of the loadTheme function I added:

    global $Site, $boardurl_default;
    if (isset($Site['domains'][$_SERVER['HTTP_HOST']]))
    {
        $sub_folder = '';
        if (substr($_SERVER['HTTP_HOST'], -20) == $boardurl_default)
            $sub_folder = '/community/';

        foreach($settings as $key => $value)
            $settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);

        foreach($modSettings as $key => $value)
            $modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . $sub_folder, $value);
    }


Edit as needed :)

Sleepy,

Does this solution tackle that problem of inter-domain cookies? Because right now I have two domains and one is 'parked' to the other, but the impossibility of having the same cookie in both domains leads to automatic logout when you close the browser in the parked one, plus once you do the login the domain changes to the 'original'.

Btw, how is this solution 'seen' by google, since I've read lots of articles recommending 301 redirects to avoid duplicate content, but I would prefer try something else instead of redirecting.
Title: Re: Multidomain SMF forum
Post by: SleePy on April 09, 2008, 07:03:09 PM
This won't solve the cookie issues. It really isn't a cookie issue more than security at play. Security is preventing other domains from accessing cookies to domains it doesn't have access to. since domain.com is different than domain.net it doesn't allow this.

There are a few tricks (one I just learned about yesterday from a charter member) to get around this. But I haven't actually tried this to or worried to much about it. I rather keep my security than worry about having users logged in across multiple domains (in time I am going to be splitting these up so we won't have worry about it).

I haven't done case studies or anything on this to see how it affects google or other search engine rankings, I am not to caring if google doesn't like it as I said I do plan on changing this in the future so it will be fixed up some day.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 09, 2008, 07:31:20 PM
hi sleepy can you have another look at my last post when you get time, I still can't get it to work

thanks
Title: Re: Multidomain SMF forum
Post by: SleePy on April 10, 2008, 12:01:07 AM
Ahh sorry.
Change it to
$domains['www.' . $dom] = $enable_www;

I cleaned up the code  a little (since I was doing detection for different folders) and made a typo there :P

That code basically appends www. to all your domains so you don't have to duplicate domains with a useless www. addition. It only does it if you have the variable set to true.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 10, 2008, 05:44:22 AM
that got rid of the error but I still can't get this to mirror on the other two domains

I give up :(
Title: Re: Multidomain SMF forum
Post by: SleePy on April 10, 2008, 01:50:59 PM
Well it will only do it if the domain is correct.
Do not put a path to the forum in the domain list. The domain list contains just the domains and then the code checks to see if the domain is in that list. If not it defaults back to the original boardurl.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 10, 2008, 07:01:11 PM
yeah that's what I did.  domain2.com and domain3.com - that didnt work so I even added in the original domain1.com, but that didnt work either.

Could be because I put it in the settings file, or where I put it in the settings file, or shouldnt that matter?

I left the rest as you have yours, including the 'community' extension just to see if it would work, but typing domain2.com/community just gave me a wordpress page with 'nothing found' on it.  Does it matter that I have wordpress running in the domain root?

Title: Re: Multidomain SMF forum
Post by: SleePy on April 10, 2008, 10:39:36 PM
well the minoring was designed for smf only so it would only function on you smf forum.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 11, 2008, 04:29:22 AM
Quote from: SleePy on April 10, 2008, 10:39:36 PM
well the minoring was designed for smf only so it would only function on you smf forum.

wait, so I'm supposed to have smf installed on the other two domains?  That's what I'm trying to avoid.
Title: Re: Multidomain SMF forum
Post by: SleePy on April 11, 2008, 12:52:24 PM
Well if you want to think of it basically, yes.

The domains should point to the same location on your website or have a commonality.
Such as my site, the default link was actually set to be pointed to the community folder while the second link was using the web root and then it would go to the community folder.

You need to be calling a SMF file on the other site for it to be able to use smf or pull up correct links.
Title: Re: Multidomain SMF forum
Post by: Eliana Tamerin on April 11, 2008, 03:31:30 PM
Has anyone tried doing this yet on 2.0? I'd be very interested in getting this working on a 2.0 forum.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 12, 2008, 07:18:45 AM
Quote from: SleePy on April 11, 2008, 12:52:24 PM
Well if you want to think of it basically, yes.

The domains should point to the same location on your website or have a commonality.
Such as my site, the default link was actually set to be pointed to the community folder while the second link was using the web root and then it would go to the community folder.

You need to be calling a SMF file on the other site for it to be able to use smf or pull up correct links.

ok well that was the vital step that was missing. 

On my original forum, I just get an internal server error


And on the secord forum however, I have it almost working in that a forum is displayed on domain2.com/forum on that second forum:

1. I can't login - internal server error    fixed that
2. all the images are missing eg new posts icons etc     fixed
3. there's a call to an undefined function for Tiny Portal in load.php (and 150 pages of errors in less than an hour heh! )

For 1. I don't know what's wrong with it

But I'm thinking that to solve 3 I will have to install everything I have on the orginal forum including all the mods?  If so then that's impossible as I need the space for other things.   :(


Some time later...

Ok I have it working as it should (as far as I can tell) but I will still have to test out a few things and make sure.  But basically there was quite a lot more involved than just changing a few files!  I have copied over all my files, mods, etc to the 2nd domain but that means for this test forum example -an extra 30mb of space used for each domain, and if I do it with the live forum it will be about 80mb for each one I want to do this to, so really they just share the database and everything else has to be duplicated. 

Does that sound right?
Title: Re: Multidomain SMF forum
Post by: cjexotic on April 14, 2008, 08:19:03 PM
Gave in and tried this again but still no luck  >:(

Any idea what the problem is?

I follow this
Quotechange seetitngs.php to force SMF to use current domain for all links:


open Settings.php

find


Code: [Select]
$boardurl = '
the rest of the line would be the already set (primary) domain

comment that line (put // as the very first in the line) and add new line below:


Code: [Select]
$boardurl = 'http://' . $_SERVER['HTTP_HOST'];

Now reload forum on new domain (not primary) and check if all links point to it domain

That is fixed

and I get urls like domain1.comdomain2.com/forum/domain3.com
which goes to a page not found


Also tried the methode SLeePy posted and that worked but I couldn't figure out how to limit catagories shown on specific forums. Also could not make that methode work with .net address's , the .net put an error in the error log anytime a post was made oven if it wasn't from the .net address
Title: Re: Multidomain SMF forum
Post by: SleePy on April 15, 2008, 12:22:23 AM
quiteperplexed,

Are they on different servers?
THe SMF files and such need to be on the same server with the domains pointing to the same location.
Title: Re: Multidomain SMF forum
Post by: perplexed on April 15, 2008, 04:13:43 AM
Quote from: SleePy on April 15, 2008, 12:22:23 AM
quiteperplexed,

Are they on different servers?
THe SMF files and such need to be on the same server with the domains pointing to the same location.


mine is working as I posted above thanks. :)
I havent fully tested everything but it looks ok.  I'm just not so happy about having to duplicate all the files as that is quite a chunk of my webspace.
Title: Re: Multidomain SMF forum
Post by: feral on April 18, 2008, 06:11:46 AM
quiteperplexed, if you can point the domains to the same folder then you don't have to have multiple installs.

Play around with the settings for each domain and see if you can have them run off of the same root directory.

Of if it is running on an apache server you can create an alias to point the /community or where ever your forum is located to the same folder on the server for each site.
Title: Re: Multidomain SMF forum
Post by: SleePy on April 19, 2008, 01:17:34 AM
Well SMF only needs a index.php and Settings.php in other folders for it to work.
As long as Setting.php points to the right files and The theme paths are ok, then it will work.
You would only want to change the boardurl though if You did that as changing the theme urls wouldn't be a good idea :P
Title: Re: Multidomain SMF forum
Post by: perplexed on April 20, 2008, 06:16:09 PM
So how do I get the settings.php etc to point to the correct files?   I tried it again just having index.php and Settings.php but that didnt work at all.

So I ftp'd all the files again, and that does work to a point, but for example the register and login links are pointing to the domain1 forum and not domain2 forum as I thought it would be?
Title: Re: Multidomain SMF forum
Post by: SleePy on April 20, 2008, 07:55:24 PM
Is settings pointing to the other forums source folder?
Title: Re: Multidomain SMF forum
Post by: Wulfen on September 22, 2008, 05:03:25 AM
Hi there!

I want to run a shared forums installation, and after having a look at this mod, it seems this one is the best for my needs. The only problem seems to be that is not being updated, as the last posts are from April of this year :-/

What I want to have is a couple of sites with forums like this:

www.red-example-site.com/forums
www.blue-example-site.com/forums

"red-site" will have forums A, B, C, X and Z
"blue-site" will have forums D, E, F, X and Z

Red and blue are hosted in the same server, and apache or some other tool (like this mod) will redirect users to one page or the other. There is just one mySQL database. Same users, and so on. I want to keep the option of adding more sites in the future. I don't use TinyPortal or anything else with SMF (my front-end is a plone site).

I'd prefer an installable mod instead of having to tweak PHP files, but I don't have much problems hacking at the templates. Though I wanted to know, before I start, if this is the right mod for me (which seems so) and if it has not been abandoned.

Regards,

Wulfen
Title: Re: Multidomain SMF forum
Post by: Wulfen on September 23, 2008, 03:19:22 AM
Hi there,

I managed to get this thing working (red forum: http://www.seduccionnatural.com/foro/ , blue forum: http://www.exito-personal.com/foro/). I've used the Omega Outline theme for both, installing it from separate directories.

Now I would like to add TinyPortal as well, and I was wondering if anyone had managed to configure TinyPortal to work with this Multidomain mod. In any case I'll try it and report back with the findings.

Regards,

Wulfen
Title: Re: Multidomain SMF forum
Post by: pinoypetfinder on September 26, 2008, 11:45:56 PM
wow multidomain smf forum, this is great. really.
i wish i can find time to modify the files so that i'll be able to do this too.

kudos to TS! :)
Title: Re: Multidomain SMF forum
Post by: swtdivalove on November 20, 2008, 03:28:37 PM
Here's an added feature that I know will prove to be QUITE difficult, but this is also as simple as turning it on and off in the ACP.

Have a setting that you can dedicate 1 category/board across the entire domain and sub domains.

Example:  Site News gets posted to the main site, then all of the sub domains have it set that when something new is posted on the main site in Site News, all of the others get it posted in their site news.  Basically, propagating 1 board across an entire domain.

Next is... Will this work on 2.0.4?
Title: Re: Multidomain SMF forum
Post by: buben06 on November 20, 2008, 08:09:02 PM
does it work on 1.1.7 ?
I just installed SMF, and followed instructions from 1 post in this thread, (without additional custom mod) and here is what I got

Fatal error: Call to undefined function: customdomainconfiguration() in /home/content/XX/Sources/Load.php on line 1395
Title: Re: Multidomain SMF forum
Post by: INamelessI on February 14, 2009, 12:14:35 PM
- park new domain on top of the primary forum domain. Make sure, that, when you open new domain in browser you

get working forum. note that all links on forum stil point to priamry domain.


im stuck here. i have a forum called. --- www.boing.com (not real)

subforum- www.b.boing.com
subforum- www.c.boing.com
subforum- www.d.boing.com

all subdomains have forums.

the rest of the line would be the already set (primary) domain

comment that line (put // as the very first in the line) and add new line below:

do i comment the whole boardurl thing? like //boardurl
Title: Re: Multidomain SMF forum
Post by: ConquerorOfMankind on February 21, 2009, 12:27:57 PM
Can anyone make this work for SMF 2.0?
Title: Re: Multidomain SMF forum
Post by: ~Killer~ on February 21, 2009, 06:00:23 PM
This is a great mod, or addon, whatever, and I really want to use it! Any chance that this will be updated to 2.0.X later?
Title: Re: Multidomain SMF forum
Post by: dno on March 13, 2009, 06:05:32 PM
I managed to finally get this working on my oldest site and my newest site. I could not get the themes to work out for me so I took a different approach.

I added a new variable after $db_prefix in the settings.php file. I used $theme_prefix. Then I went through all the files in the sources folder and did a global search and replace changing {$db_prefix}themes to {$themes_prefix}themes. Then I did a search on every page that had a result and every function that had {$themes_prefix} I added $themes_prefix to the global delcaration. Then I copied the themes table with a different prefix for the other site.

With that done all I need to now when adding sites to the mix is define what prefix the table has for a specific sites themes. What is important is that the themes in each of the theme tables have the same name and ID, we don't allow changing of themes and just specify that everyone should be using the "main" theme.

It seems to work fairly well. We have our trukx.com/forum site added with it's own theme and main category of forums on top and our oldest site popupexplorer.com/forum displaying a different main category of forums, all other categories are shared. In this way we hope to give each site a niche flavor.
Title: Re: Multidomain SMF forum
Post by: Darkness_ on March 19, 2009, 02:50:43 PM
did someone got this one working for SMF 2.0 beta 4 ?
Title: Re: Multidomain SMF forum
Post by: dno on March 31, 2009, 01:23:51 PM
My guess is no, but I would hope that someone does and also makes it so it can install via the regular modification process. If I had one complaint about this mod it's that it does not install via the mod process which makes it difficult to get other mods working. It does what I need it to do which was to give two different groups of people that frequent my sites what they wanted.

As I've read I keep seeing many comments about why you would want to do this, just tell everyone to go to one forum.

For me I felt that would end up being the death of my site. The success of my site was built on a niche and there are at least two other sites that occasionally nip at my heels. I had one group of people that wanted the site to remain true to the niche but another group that was increasingly growing in numbers wanted to remain part of the community even though they changed their type of RV away from the niche focus. Opening the site up to all RV types would erode my lead in the niche which at this point is our bread and butter. I had created other brands and other forums to focus on other RV types but none really gained nearly the traffic the original site did.

By combining all the forums and selecting what content appears on which forum I can still focus on the niche while creating a place for the others to participate and remain part of the community through some of the general forums. It's only been about a week since we switched over a couple sites to the new combined forum, but so far it seems well recieved.

It's been interesting to see how each group percieves the change. It appears each group feels they got what they wanted.
Title: Re: Multidomain SMF forum
Post by: Dejv on December 16, 2010, 05:32:10 PM
Hi,

Does it work for 1.1.18?
Any updates on 2.0?

Would it be possible to save the mulltidomains in smf_members table?

Possible to show two categories for some forums?

Thanks
Title: Re: Multidomain SMF forum
Post by: Douglas on April 10, 2011, 08:54:08 PM
Need to bump this back up.  Really need to know if this has been or can be updated to work with the latest 2.x branch.  :)

Don't really need separate theme/forum support... just the multi-domain support.  :)

Thanks!
Title: Re: Multidomain SMF forum
Post by: Clara Listensprechen on April 10, 2011, 11:18:20 PM
I'd like to know, too--it's why I've subscribed to this thread. Answers--we need answers!!
Title: Re: Multidomain SMF forum
Post by: RvG on April 19, 2011, 03:09:22 PM
thank you for bumping... :)
Need help to make it work with SMF 2.0
Title: Re: Multidomain SMF forum
Post by: hhy89 on October 22, 2011, 12:08:54 PM
i have upgrade this
http://www.simplemachines.org/community/index.php?topic=456860.0
Title: Re: Multidomain SMF forum
Post by: zapiy on November 15, 2011, 06:46:49 AM
This was upgraded but i need some help if anyone can please?
Title: Re: Multidomain SMF forum
Post by: Galaxy Computers on November 04, 2015, 10:03:23 AM
Will this mod:

1) Have separate forums for each subdomains?
2) Each Categories different on each forums?

But here is one problem. lets say this subdomain.domain.com redirects to the main domain. That doesn't called mirror its called redirects to the main domain.
Title: Re: Multidomain SMF forum
Post by: Hj Ahmad Rasyid Hj Ismail on November 05, 2015, 08:37:29 PM
I am not so sure but you can try this mod alternatives:
1. PMx-SubForums Mod (http://custom.simplemachines.org/mods/index.php?mod=3148) - Support (http://portamx.com/pmx-subforums/)
2. Split Forum Mod (http://custom.simplemachines.org/mods/index.php?mod=3730) - Support (http://www.simplemachines.org/community/index.php?topic=523055.0)

I would prefer the first one, as the second is still in heavy development.