Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
I am trying to integrate Q2A's log-in/ userbase with a portal script, but NOT using your integrated log in method.

The reason is that the other script (a portal script) is designed to rely on the userbase of one of several types of forum such as AEF, PHBB, etc.

I wish to adapt it to accept Q2A.



case 'AEF':
                     $dbuser = $globals['user'];
                    $dbpasswd = $globals['password'];
                    $dbname = $globals['database'];
                    $dbhost = $globals['server'];

Needs to be replaced with the Q2A equivalent:

case 'Q2A':
                     dbuser = ?????
                    $dbpasswd = ?????
                    $dbname = ?????
                    $dbhost = ?????

Can you advise? Much appreciated.
Q2A version: latest (27/06/2012)
edited by
Deleted comment as the person who it was aimed at has also dleted their comment.
edited by
Deleted comment as the person who it was aimed at has also dleted their comment.
Those details you are looking for above just appear to be database connection details. Aren't those the same as everything else, with perhaps a different database? In any case, they will just be whatever values you filled in the Q2A config already.
Hi Scott, thanks for your answer. The problem i'm having is that the portal script requires me to enter the database details in exactly the same way that the Q2A script does.
In the q2a config file, it's written as:
        define('QA_MYSQL_HOSTNAME', 'localhost');
        define('QA_MYSQL_USERNAME', 'myhost_chris');
    define('QA_MYSQL_PASSWORD', 'password');
    define('QA_MYSQL_DATABASE', 'myhost_mydatabase');

(The example in  my original Q shows the way it's written for the AEF forum)
However, the portal doesn't seem to recognise what is meant by 'define'.
The portal is attempting to equate Q2A's details with it's own 'format', i.e. in the AEF example, $dbuser = ????
becomes $dbuser = $globals['user'];

If i use $dbuser =define('QA_MYSQL_USERNAME', 'myhost_chris');
It makes no sense to the script whatsoever.
I'd really appreciate it if you could advise me further?

2 Answers

0 votes
Check out http://question2answer.org/external.php

this is documented.
Thank you too for your answer. If i could just explain a bit further?
Your Q2A script is well thought out and geared up to integrate with other sites, but the script i'm trying to run it with does not have a user base of it's own, but rather relies on the user database of other scripts. This means that i would have to install Q2A with it's own user database, rather than by using the external config. My portal would then use Q2A's userbase.
If i was to integrate a forum called MyBB with the portal, then the correct settings would be:
                                        $dbhost = $config['hostname'];
                    $dbname = $config['database'];
                    $dbuser = $config['username'];
                    $dbpasswd = $config['password']

If i use the AEF forum, the settings would be:
                    $dbuser = $globals['user'];
                    $dbpasswd = $globals['password'];
                    $dbname = $globals['database'];
                    $dbhost = $globals['server'];

If i were to use the VB forum with my portal, the settings would be:
                                $dbhost = $config['MasterServer']['servername'];
                  $dbname = $config['Database']['dbname'];
                  $dbuser = $config['MasterServer']['username'];
                  $dbpasswd = $config['MasterServer']['password'];

But instead of those, i wish to use Q2A's equivalent.
As mentioned above, this:
        $dbhost =define('QA_MYSQL_HOSTNAME', 'localhost');
        $dbuser =define('QA_MYSQL_USERNAME', 'myhost_chris');
        $dbpasswd =define('QA_MYSQL_PASSWORD', 'password');
        $dbname =define('QA_MYSQL_DATABASE', 'myhost_mydatabase');

Simply doesn't work. Your help would be most appreciated.
Aslo, you're quite welcome to look at the portal site i'm using if it helps to get a better idea, just click on the 'forum' link and understand that i wish to replace that with Q2A. Thanks for taking the time to assist.
0 votes

You take the values from inside the define(...) statements. For example:

$dbname = 'myhost_mydatabase';