Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
336 views
in Plugins by
edited by

I have a special scenario currently: I have extended q2a with a booking system. Special members can be booked. The plugin uses many of the provided q2a functions and some tables from the database.

Now I need to "outsource" the booking feature (or let's say "provide") outside of the main domain to another domain: mybookingq2astuff.com

Question is: How can I have all features of the plugin in the other website. With all reading from/writing to database etc.

... what would be the necessary includes in a custom index.php to have q2a running no the other site?

Sidenote: I don't need the questions from qa_posts, no need for a question list. I only need the user-related tables: qa_userpoints, qa_users, qa_usermetas, plus 3 custom plugin tables.

Update: I would also need the login feature since only registered users are supposed to book experts.

I am stuck here, as this is new territory :)

1 Answer

+2 votes
by
selected by
 
Best answer
I think you'll find the answers here: http://www.question2answer.org/external.php
by
edited by
To be honest: it is just beautiful.

I still cannot believe that you pre-thought so many thinks. My sincere respect to you.
by
I have tried the example code provided on the external.php website, it always shows "not logged in". Could it be that the qa_get_logged_in_userid() cannot "see" the login state (i.e. cannot access the session) from the other domain? I read in the net that sessions could be accessed over different domains. However, I am sure cookies cannot be accessed over different domains.

It would be helpful to provide this information on the external.php page.

PS: My recent folder structure
/q2a-domain/
/q2a-domain/external → running at otherdomain.com

So from otherdomain.com I am doing the:
require_once '../qa-include/qa-base.php';
by
My main requirement is to call the q2a functions and especially to access the pages created from my plugins.

E.g. q2a-domain/page1 should be accessible via otherdomain.com/page1 - possible?
by
Yes, the cookie won't work across domains. You can use QA_COOKIE_DOMAIN in qa-config.php if you have a joint superdomain, but it won't work if there's no connection between the two.
by
And it seems that the session cannot be read on the other domain neither?

Plus, any idea how I can make the pages work on the other domain?

Thanks gid.
by
Update: I try to map both domains on one. I check if it is the extra domain, then I load another theme file, this way I have some freedom in structure and design while preserving features and database access.
...