• Resolved adityairvndn

    (@adityairvndn)


    hi, I actually like this plugin, but the reject feature in the plugin I think will fill my user database for a long time.
    My membership website uses several photos as a reference for the membership registration to be approved or not. And for now, when a member rejects the registration application, the data is still there.
    I want when the admin rejects a member registration application, the user and data from that member must also be deleted and the system sends him an email about the registration application not being accepted. Can this plugin do it?
    Or maybe there is a function that I should add to function.php ?

    Actually I thought to immediately use the delete user feature when the registration application was not received so that user data could be deleted, but when later there was a user who really wanted to delete his account, he ended up getting an email containing “your registration application was not accepted”. Even though he just deleted it.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @adityairvndn

    You can try this code snippet below. The code will delete a user on rejection. It won’t send the delete user notification. It will send the Reject user notification set in WP Admin > Ultimate Member > Settings > Emails.

    add_action("um_after_user_status_is_changed","um_011822_delete_account_on_rejection", 10, 2);
    function um_011822_delete_account_on_rejection( $status, $user_id ) {
    
        if( "rejected" == $status ) {
            
            // Disable delete notification on rejection and deletion
            UM()->user()->send_mail_on_delete = false;
    
            if ( is_multisite() ) {
    
                if ( ! function_exists( 'wpmu_delete_user' ) ) {
                    require_once( ABSPATH . 'wp-admin/includes/ms.php' );
                }
                 
                wpmu_delete_user( $user_id );
    
            } else {
    
                if ( ! function_exists( 'wp_delete_user' ) ) {
                    require_once( ABSPATH . 'wp-admin/includes/user.php' );
                }
                
                wp_delete_user( $user_id );
    
            }
    
        }
    }

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @adityairvndn

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to delete a member when we reject the registration application’ is closed to new replies.