FBC on sites with multiple domains

Revision as of 00:00, 21 January 2013 by Sinisakrisan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Some websites have a couple of domains pointing to the same Joomla system. Facebook App in www.facebook.com/developers however only allow you to associate one domain for each Application Secret and API Key.

To remedy this issue, first you will have to create three separate FB Apps in Facebook Developers area (or more, according to your requirement).

Then please open up
For JomSocial 2.4

components\com_community\libraries\core.php, Line 846

For JomSocial 2.8: components\com_community\libraries\core.php, Line 1147.

$value = $this->_jparam->get($key, $default, $group);


Modify it to be

       if ($key == 'fbconnectkey' || $key == 'fbconnectsecret')
        {
            $url = new JURI(JURI::base());
            $urlDomain = $url->toString(array('scheme', 'host'));
 
            switch ($urlDomain) {
                case 'http://www.myfirstdomain.com':
                    return ($key == 'fbconnectkey') ? '14myAPIkey60' : '7d142myapplicationsecretde0fb0';
                    break;
                case 'http://www.myseconddomain.com':
                    return ($key == 'fbconnectkey') ? '14myAPIkey60' : '7d142myapplicationsecretde0fb0';
                    break;
                case 'http://www.mythirddomain.com':
                    return ($key == 'fbconnectkey') ? '14myAPIkey60' : '7d142myapplicationsecretde0fb0';
                    break;
            }
        }
 
        $value = $this->_jparam->get($key, $default, $group);


You are now good to go!

Credit: Adam Lin (JomSocial Developer)