BuddyDev

Search

[Resolved] buddypress Deactivate Account Plugin

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #18903

    Hi Jeff,
    We have a filter to allow any user to act as admin for deactivation.

    Here is an example where I am checking if the current user is editor and if it is true, we allow to see the button and do it for other users.

    
    
    /**
     * @param $allow
     *
     * @return bool
     */
    function buddydev_custom_deactivator_permission( $allow ) {
    
    	// let us allow editors.
    	if ( ! $allow ) {
    		$allow = current_user_can( 'delete_others_posts' );
    	}
    
    	return $allow;
    }
    
    add_filter( 'bp_account_deactivator_user_can_change_account_status', 'buddydev_custom_deactivator_permission' );
    
    

    If you have a custom role, You may be using some custom capability. You can swap the capability with your own.

    Please let me know if it works.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #18910

    Thank you sir. I’m sticking with the editor role so this should work. I’ve added this code to the bp-deactivate-functions.php (assuming that’s the right place?) but I still don’t see the button when logged in as user with editor role.

    Any thoughts?

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #18919

    Hi Jeff,

    Please remove the code from p-deactivate-functions.php and put it in wp-content/plugins/bp-custom.php

    If there is no bp-custom.php, please create a php file named bp-custom.php

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #18928

    Perfect! Thank you sir!

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #18929

    You are welcome.

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #19263

    Hi there, followup question on this. Can you recommend a way to bring the deactivate button in to the members loop as a clickable button on each member’s div in the loop?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #19265

    Hi Jeff,
    Thank you for asking. You will have to wait a little as our button generator has private scope currently. I will need to mark it public before we can ue it. Please allow me 2 days to push an update.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #19292

    Absolutely. Thank you sir!

  • Participant
    Level: Enlightened
    Posts: 23
    y2gabs on #19471

    Hey there, I see that the plugin was updated but is there any reference docs to understand how to include the deactivate button in the members loop?

    Thanks!

The topic ‘ [Resolved] buddypress Deactivate Account Plugin’ is closed to new replies.

This topic is: resolved