BuddyDev

BuddyPress Deactivate Account

BuddyPress Deactivate Account plugin allows users to deactivate/reactivate their account on a BuddyPress based social network. With this plugin, you allow your users to remove themself from any social activity or visibility. This plugin allows them to reactivate their account later without loosing any data.

This plugin can also be used to block users from logging to a BuddyPress site.

Features:-

  • Allow users to deactivate/reactivate account
  • Allow site admins to deactivate/reactivate user account
  • Allow site admins to block users from logging in
  • Option to automatically logout on deactivation(User will be logged out from all devices/sessions).
  • Option to automatically activate account on login
  • Option to send email notification to site admins and users on account activation/deactivation.
  • Easy to use admin panel
  • 100% translatable

You can use this plugin to let users activate/deactivate their account or as a tool to block users from your site.

When an account is deactivated:-

  • The deactivated user can not perform any action unless their account is active again.
  • Deactivated user's activities are hidden from all user
  • Deactivated user's profile is hidden from all users
  • Deactivated user can not receive/send friendship requests or messages
  • Deactivated users can not login(If admin enables this option).

This plugin will work if you have BuddyPress Settings component enabled.

Screenshots:-

Admin Settings:-

Front end account:-

 

Admin filtering and status updates:-

 

 

Account deactivate message:-

notice-user

If admin has allowed users to activate/deactivate their account, a user can deactivate/reactivate their account by visiting settings page from their profile.

BuddyPress Deactivate Account Plugin API:-

The BuddyPress deactivate account plugin provides simple api for activating, deactivating account and checking the status of the account using a few lines of code.

Mark a user account inactive:-

bp_account_deactivator()->set_inactive( $user_id );

Mark the user account active:-

bp_account_deactivator()->set_active( $user_id );

Check if a user account is inactive:-

bp_account_deactivator()->is_inactive( $user_id );

Check if a user account is active:-

You can use the previous function with a negation, or use the following function:-

bp_account_deactivator()->is_active( $user_id );

Check if logged in user's account is inactive:-

You can either use bp_account_deactivator()->is_inactive( get_current_user_id() ) or you can use the following:-

bp_account_deactivator()->is_logged_user_inactive();

The benefit of using is_logged_user_inactive() is that it stores the state in a static variable and repeatative calls are inexpensive.

Check if displayed user account is inactive:-

Like the logged in account, you can check for this using bp_account_deactivator()->is_inactive( bp_displayed_user_id() ) or the following call

bp_account_deactivator()->is_displayed_user_inactive();

The benefit of  using is_displayed_user_inactive() is better performance on repetitive calls.

CSS Classes in Body:-

The following css classes are added on 'body' element based on user status.

  • For inactive logged in user :- bp-deactivator-logged-inactive
  • For active logged in user:- bp-deactivator-logged-active
  • For inactive displayed user:- bp-deactivator-displayed-inactive
  • For active displayed user:- bp-deactivator-displayed-active

You can use it to target and style specific elements if you wish to do so.

Release History

  • Version: 1.2.3

    Saturday, 24 February, 2024
    • Tested With: BuddyPress 11.3.1
    • Compatible With: BuddyPress 7.0+

    Bumping version to regenerate archive for WordPress 6.4.3 compatibility.

  • Version: 1.2.2

    Saturday, 23 October, 2021
    • Tested With: BuddyPress 10.3.0
    • Compatible With: BuddyPress 7.0+

    Fixes 404 issue if a user logs out from their deactivation settings page while using BuddyBoss.

  • Version: 1.2.1

    Wednesday, 09 June, 2021
    • Tested With: BuddyPress 9.0.0
    • Compatible With: BuddyPress 7.0+

    Enhanced experienced for site admins if they deactivate a user account in dashboard(No redirect to user profile).

  • Version: 1.2.0

    Monday, 21 October, 2019
    • Tested With: BuddyPress 5.0
    • Compatible With: BuddyPress 4.0+

    Fix Activate button not showing on user profile.
    Fix Logout on deactivation even when the settitng was not enabled.
    Fix persistent notice on activation.

  • Version: 1.1.8

    Sunday, 28 July, 2019
    • Tested With: BuddyPress 5.0
    • Compatible With: BuddyPress 2.5+

    Add action to allow extra settings.
    Make the hooks singleton to allow reuse button generator.

  • Version: 1.1.7

    Wednesday, 05 December, 2018
    • Tested With: BuddyPress 4.1
    • Compatible With: BuddyPress 2.5+

    Updating the settings framework.

  • Version: 1.1.6

    Wednesday, 15 August, 2018
    • Tested With: BuddyPress 3.1
    • Compatible With: BuddyPress 2.5+

    Fix the fatal Ajax handler when other plugin using PT settings framework is active.

  • Version: 1.1.5

    Monday, 02 July, 2018
    • Tested With: BuddyPress 3.1
    • Compatible With: BuddyPress 2.5+

    Added 4 new filter to provide more control via API. Mails can be disabled conditionally using these filters.

  • Version: 1.1.4

    Sunday, 17 June, 2018
    • Tested With: BuddyPress 3.1
    • Compatible With: BuddyPress 2.5+

    Fix admin notification.
    Make sure the pt settings is not loaded early.

  • Version: 1.1.3

    Tuesday, 01 May, 2018
    • Tested With: BuddyPress 2.9.4
    • Compatible With: BuddyPress 2.5+

    1. If logout is enabled, Logout user from all devices on account deactivation.
    2. Added css classes to body to allow easy styling.

  • Version: 1.1.2

    Wednesday, 06 December, 2017
    • Tested With: BuddyPress 2.9.2
    • Compatible With: BuddyPress 2.5+

    Fix the settings notice which needed double saving to show correct message.

  • Version: 1.1.1

    Saturday, 04 November, 2017
    • Tested With: BuddyPress 2.9.2
    • Compatible With: BuddyPress 2.5+

    Fix the settings loader path to be case sensitive.

  • Version: 1.1.0

    Wednesday, 27 September, 2017
    • Tested With: BuddyPress 2.9.1
    • Compatible With: BuddyPress 2.5+

    Major Updates with email notifications for activation/deactivation, user blocking, admin users list of deactivated users and a lot more. Please see plugin page for details.

  • Version: 1.0.6

    Friday, 30 June, 2017
    • Tested With: BuddyPress 2.8.2
    • Compatible With: BuddyPress 2.5+

    Updated to fix translation of the account status tab title.

  • Version: 1.0.5

    Friday, 17 March, 2017
    • Tested With: BuddyPress 2.8.2
    • Compatible With: BuddyPress 2.5+

    Updated and tested with BuddyPress 2.8.2.

  • Version: 1.0.4

    Wednesday, 28 December, 2016
    • Tested With: BuddyPress 2.7.4
    • Compatible With: BuddyPress 2.0+

    Updated to allow admins to set user accounts active/deactive from front end too. Also fix the total number of active users/

  • Version: 1.0.3

    Thursday, 04 August, 2016
    • Tested With: BuddyPress 2.6.1.1
    • Compatible With: BuddyPress 2.0+

    Fix a typo in the notice message.

  • Version: 1.0.2

    Tuesday, 12 July, 2016
    • Tested With: BuddyPress 2.6.1.1
    • Compatible With: BuddyPress 2.0+

    Updated for BuddyPress 2.5.1. Improves code.

  • Version: 1.0.1

    Thursday, 22 October, 2015
    • Tested With: BuddyPress 2.3.4
    • Compatible With: BuddyPress 2.0

    Add translation support.
    Allow Admins to update User account status from Dashboard->Edit user page.

  • Version: 1.0.0

    Monday, 25 May, 2015
    • Tested With: BuddyPress 2.3.4
    • Compatible With: BuddyPress 2.0+

    Initial release