Tagged: account, bp, buddypress, deactivate
Hi Brajesh,
I hope you are doing well. I purchased your BP deactivate account plugin which is being used to my liking. However, I am having an issue with the logging user out after deactivation. For some reason, wp_logout() doesn’t seem to be working and the user remains logged in. The setting is checked in the admin settings. The user in fact gets deactivated but does not get logged out. Is this an issue you have come across before?
Hi David,
I am sorry for the inconvenience.Is there anything specific about your installation. I tested on WordPress 4.9 and BuddyPress 2.9.2 again and it is working.
1. Are you on multisite?
2. Are you using any caching plugin?
3. What happens when user deactivates account?Thank you
BrajeshHi Brajesh. Sorry for the late reply. To answer your questions, it is not a multisite, I do not have any caching plugin. The way I am using it is to suspend users, so I do not allow uses to deactivate their own account. However, what happens is the user gets suspended but they are still allowed to navigate buddypress with limited access. The issue seems to be with this line of code.
$is_manager = bp_account_deactivator()->current_user_can_change_account_status(); $logged_out = false; if ( ! $is_manager && $deactivator->get_option( 'logout-on-deactivation' ) ) { wp_logout(); $logged_out = true; }
I noticed that if I get rid of the conditional statement, and just allow wp_logout(), the user that gets logged out is the admin and not the blocked user.
Hi David,
Thank you.That condition is to avoid logging out the user if the user is site admin(or if you are adding custom code to allow other users having the option to deactivate other user’s account).
I hope that you were most probably logged in as admin while trying to deactivate account. is that correct?
Regards
BrajeshHi David,
I am sorry, I was not sure earlier.What you are trying is destroying all sessions of the user.
For now, It is not available in Deactivate Account(I am adding it as it is a very good feature).
You can still logout a user from everywhere by Visiting Dashboard->Users and clicking on Edit User, you will see a “logout from everywhere’ button there. The functionality is offered by WordPress core.
Hope that helps.
BrajeshOk, I assumed that was what was meant by “logout user on deactivation”. I did not know that the user him/herself would be the one to have to deactivate in order to logout. Can I expect this update to the plugin in the near future? I hate to have to edit the plugin but for now I will mess around with WP_Session_Tokens::get_instance($user_id) and destroy_all and see if I can fiddle something for myself
Hi David,
Thank you. We will have it in the next update(within this week). Currently the logout option only logs out from current session.
You must be logged in to reply to this topic.