Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

How to syncronize joomla with Question Answer

+1 vote
asked Oct 28, 2011 in Q2A Core by Levy Raveloson

1 Answer

0 votes

If you want to use the Joomla Framework within Question2Answer I think you will want to add something like this to your Q2A code.

Please note that this is not my code, so I probably won't be able to answer any questions about it.

I believe the code below was intended for external PHP that would be used with Joomla 1.5.

<?php

define( '_JEXEC', 1 );
 
// real path depending on the type of server
// change the number of returns/level needed in your path relative to the position of your script in your directory
if (stristr( $_SERVER['SERVER_SOFTWARE'], 'win32' )) {
define( 'JPATH_BASE', realpath(dirname(__FILE__).'\..\..\..\..' ));
} else define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
 
define( 'DS', DIRECTORY_SEPARATOR );
 
// loading framework of Joomla!
require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
 
// if need a specific language component, you can load it here
 
jimport( 'joomla.plugin.plugin' );
 
JPlugin::loadLanguage( 'com_xxxxxxxxx' );
 
// original code here or your code continue here ...
2?>
 
 
answered Oct 30, 2011 by moomoochoo
I should say that this doesn't synchronise users it just allows you to use some of the Joomla functionality in Q2A.
If you want your Q2A to work using your Joomla database I think you will need to take a look at http://www.question2answer.org/single-sign-on.php