Resolved Can’t Disconnect Users

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
I can confirm the error when I try to disconnect the user and I'm still trying to figure out why the fs_blog_admin script only seems to run on that user and not others (or at least, not the test account).

There's nothing that indicates to me there is an error in how XFtoWP functions, but only interference from this script. To answer your question, sync data is stored to a the usermeta of every user in the database.

If you can afford it, try to delete the user and resync it with a new account. I'd be curious if that helps. I also wonder if the plugins that use Freemius connect to a user in any way that may trigger its scripts to only load for certain users?
 
Comment

thunderclap82

Active member
XFtoWP
Messages
46
Reaction score
6
I've bumped into another issue with a different user, though this time WP is saying the email is already taken when it isn't. Is it possible to get a copy of 1.2 and rollback to see if that resolves the issue?
 
Comment

thunderclap82

Active member
XFtoWP
Messages
46
Reaction score
6
And while I await a response from the previous question, I went ahead and removed the info under xfwp in usermeta in the database. Now when I try to sync via the username or email it says "Error: The user "" has already been verified."
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
I've bumped into another issue with a different user, though this time WP is saying the email is already taken when it isn't. Is it possible to get a copy of 1.2 and rollback to see if that resolves the issue?
This is a minor issue where XFtoWP blocks user registration if a duplicate email is found, but this check shouldn't extend to the user sync where you are trying it now. That is a minor patch I can send out later tonight as it has been on my todo list.

And while I await a response from the previous question, I went ahead and removed the info under xfwp in usermeta in the database. Now when I try to sync via the username or email it says "Error: The user "" has already been verified."
There is also a record set to the xfwp option table so there is a high level log of XF users IDs assigned to WP users. That requires another process to unset, which you can do with this quick code snippet.

Paste this into your theme's functions.php file and change the $wp_user_id variable to the WP user that is affected. Refresh your site once, then delete this code. It should update the record in the wp_options table to fully un-sync the user.

PHP:
// Disconnect data from WP user ID
$wp_user_id = 13;
// Do not edit below
$option = xf_option();
$xf_user_id = xf_user_meta( $wp_user_id, 'main_account' );
unset( $option['connected_users'][$wp_user_id] );
$option['xf_users'][$xf_user_id] = '';
update_option( 'xfwp', $option );
 
Last edited:
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
@thunderclap82 thanks for your patience, I spent some time with this yesterday and working on it now. I should have answers for you shortly.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
Update: I was able to reconnect the user you were having issues with. I also don't see a problem disconnecting/reconnecting on the fly, and the test user you provided also works for me too.

Are you having any problems with other users? I have not found the JS error message in either of my tests today.
 
Comment

thunderclap82

Active member
XFtoWP
Messages
46
Reaction score
6
I've tested a few other accounts and it seems to be working. That said, and I hate to admit this, I messed up your change for the one user. I didn't realize you'd fixed it (I saw your post after I was messing around with it) and the one user, again, isn't linking properly. 🤦‍♂️ Sorry about that. Can you tell me how you fixed it so I can go in and correct it?
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
I've tested a few other accounts and it seems to be working. That said, and I hate to admit this, I messed up your change for the one user. I didn't realize you'd fixed it (I saw your post after I was messing around with it) and the one user, again, isn't linking properly. 🤦‍♂️ Sorry about that. Can you tell me how you fixed it so I can go in and correct it?
Not a problem! You cleared the usermeta from the database again, correct?

The script above won't work since it the usermeta is cleared, so you can run this in your functions.php (save, refresh page one, then delete code) to unset the user data from the sync log:

PHP:
$option = xf_option();
$option['xf_users'][XF_ID_HERE] = '';
update_option( 'xfwp', $option );

Replace XF_ID_HERE with the number ID of the XenForo user. Example, if the user ID is 999 the $option line will look like:

PHP:
$option['xf_users'][999] = '';

For future reference if you want to manually unsync a user, refer to the code in my first post to do it through your functions file instead of clearing user tables. This will change in XFtoWP 1.5 as users will be logged in a different way, but perfectly suitable for now.

I am curious where those fs_blog_admin errors went. :/
 
Comment

thunderclap82

Active member
XFtoWP
Messages
46
Reaction score
6
Not a problem! You cleared the usermeta from the database again, correct?

The script above won't work since it the usermeta is cleared, so you can run this in your functions.php (save, refresh page one, then delete code) to unset the user data from the sync log:

PHP:
$option = xf_option();
$option['xf_users'][XF_ID_HERE] = '';
update_option( 'xfwp', $option );

Replace XF_ID_HERE with the number ID of the XenForo user. Example, if the user ID is 999 the $option line will look like:

PHP:
$option['xf_users'][999] = '';

For future reference if you want to manually unsync a user, refer to the code in my first post to do it through your functions file instead of clearing user tables. This will change in XFtoWP 1.5 as users will be logged in a different way, but perfectly suitable for now.

I am curious where those fs_blog_admin errors went. :/
All right, not sure why I'm struggling with this. I added the code to functions.php (both in the main theme as well as the child theme) and after refreshing the webpage no code is added to the usermeta for the user and it won't sync, giving the error Error: The user "" has already been verified.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
All right, not sure why I'm struggling with this. I added the code to functions.php (both in the main theme as well as the child theme) and after refreshing the webpage no code is added to the usermeta for the user and it won't sync, giving the error Error: The user "" has already been verified.
You used the XF user ID, right? I pasted the code with the user in question's XF ID to your functions.php, reloaded, and I can now connect/disconnect the user (I left them connected for you).
 
Comment

thunderclap82

Active member
XFtoWP
Messages
46
Reaction score
6
Well now I feel stupid. I was using the WP user ID, not the Xenforo one. Your way makes much more sense.

Thanks for helping throughout this ordeal.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,271
Reaction score
1,693
No big deal, the very first code snippet was meant for the WP user ID and if the usermeta were intact, it would have also properly cleared the XF user meta and logs. Without usermeta, we had to use the XF user ID, so easy to mix up!
 
Comment
Top