7

I have a running normal WP blog (blog 1). I want to create a Q&A section for my users, so I setup another blog with WP-Answer theme (blog 2).

The problem is I don't want my users at blog 1 have to register at blog 2 to post questions. I want they automatically grant the same privileges at blog 2.

How can this be achieved? Do you have any advice for me?

Thank you very much.

4
  • I'd give you an answer if I could have a look at the WP-Answers theme. Do you have a download link?
    – kaiser
    Jun 14, 2011 at 11:15
  • @kaiser: it's a commercial plugin and that wouldn't be nice if I put a download link here. But I can give you via email. Just let me know your email :)
    – Anh Tran
    Jun 15, 2011 at 15:09
  • The answer below looks pretty good as single sign on solution. I guess you don't need my help anymore. :)
    – kaiser
    Jun 15, 2011 at 15:44
  • i wanted to ask the same question, ended here instead of creating duplicate question
    – Krishna
    May 5, 2012 at 6:08

4 Answers 4

4

I think you want to install your second site on the same database but with a different table prefix, e.g. $table_prefix = "qa_"; in wp-config.php

You are then able to define a custom user and/or user_meta table by adding the following lines to wp-config.php

define('CUSTOM_USER_TABLE', [orig_table_prefix].'my_users');
define('CUSTOM_USER_META_TABLE', [orig_table_prefix].'my_usermeta');

Source: http://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables

I have read somewhere before that you may have to sort out a couple of issues of admin users on the second site, can't find the link at the moment.

1
  • +1. Actually, I use 2 databases now. But your solution looks good. The site is in developing, so I'll install the WP-Answers on the same db. Thanks so much.
    – Anh Tran
    Jun 15, 2011 at 15:04
3

I think the easiest would be to keep one site, and only apply your Q&A styles to the pages you need. That way you keep everything centralized in one WP install.

If you use body_class() you can target any page/post from your CSS and apply the styles you want only where you need them.

It would go something like this, if your Q&A pages have a common template named question_answer.php you can style them like with :

.page-template-question_answer{ background:#FAFAFA }
.page-template-question_answer #conent{ width:500px }
2
  • 2
    I agree. I see absolutely no reason to separate blog functionality into an entirely separate WordPress install. Jun 14, 2011 at 12:59
  • The problem is I don't want to reinvent the wheel. WP-Answers theme is good, and I just want to use it. I think using a page template for Q&A section is hard to extendable in the future.
    – Anh Tran
    Jun 16, 2011 at 6:26
2

I'm guessing you'll probably want them to be automatically logged in to the Q&A site, otherwise it's not much better than registering twice. Your best bet is probably to change your original site to a multisite instance and have the Q&A site be another site within the same WordPress installation. Then find a plugin that will automatically grant a certain user role without you having to add them manually, such as http://wordpress.org/extend/plugins/multisite-user-management/

Also see: http://codex.wordpress.org/Create_A_Network

If you're on shared hosting, it's possible that you might run into difficulties getting multisite set up, but it's still probably the best solution.

1
  • +1. I was thinking about MultiSite, but I don't have much experience about this. I need to test this carefully. Thanks.
    – Anh Tran
    Jun 15, 2011 at 15:05
2

Don't forget that you'll need not only the CUSTOM_USER_(META_)TABLE pointing to the main sites user table in the wp-config.php of your child site, but also the AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY constants should be exactly the same as on your main site. This will avoid generating new passwords. Should work out of the box.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.