Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Plugins by
I am developing plugin which allows WordPress integreation on Running Q2A Site. Now concept is not so difficult but one complication I found is transfering Q2A users.

Where all content identify by userid ( ofcourse ) this can give real trouble while merging WP users and Q2A users in same table.

If I auto increament Q2A user id in WP table than it will creates great trouble to identify the content and of course everything will messed up.

Any idea suggestion?

1 Answer

0 votes
Can't you just add a field "userid" to the WP table and then transfer?
WordPress has own userid field in user table. The issue is if I alter users registered with WP that can create issue with WP existing blog and other stuffs and if I alter Q2A userid than it can ruin Q2A stuffs. So this is really complicated situation I found. Need some rock solid solution to combine them after installation.
Sounds difficult. First idea was an extra table that maps WPuserid <-> Q2Auserid. But then you have to integrate them in both systems somehow...

Why can't the Q2A userids be the same as in WP or vice versa?
It can't be same because both system are not combined but separate and both have different userid assigned to different user. Which may or may not the same for both system.

For instance:
Ignore Admin which will be always 1 id
ABC user has ID 2 in Wordpress
Where XYZ user has ID 2 in Q2A

Now you imagine what will happen if we merge both user with the same ID? In fact it's not possible.
ABC user has ID 2 in Wordpress
ABC user has ID 13 in Q2A

Question is how hard would it be to change the userids in one system or the other? Before migration.
I thought that too.. to change/alter WP user ids before I move all Q2A users. But there is a problem again. Let's say if WP site has 100 blogs created by 10 users and if userid change than blog will become orphan or will belongs to wrong userid.

Changing ID is not an issue but keeping data belongs to the same ID is difficult here.
Oh one thought... I may can update useid information in all WP tables. Which is quite hard but may be need to give it a try.
edited by
actually you proved that my decision x years ago, not to use wordpress, was a good one ;) ... but well, this statement will not help solving this issue :(

When changing ids you should go 2 steps, not directly "2" → "13" because then you would mess up reseting "13" → "28". So take a very high number for each former userid, e.g. "2" → "5 000 002", afterwards you are done with all, you can remove the 5 000 00 for this example...
No your comment is not off topic but right to the topic :) In fact today I wrote an article on it. http://www.q2amarket.com/q2a-tips-n-tricks/question2answer-with-single-sign-on-all-you-need-to-know-before-installing/

Yes I will try with higher value. Just curious to know if it works else it will be real difficult to combine with both system's users and have to compromise with any of one system's users.
Have u already sorted out where userids are present? Where the changes have to be done?
No this I will do tomorrow or so.. Currently busy with another plugin. You know that which one.. :) Making the user guide video.

Are you working on this user ids?
nope, doing something completely different now...