I need to allow users to delete their accounts on the front end, but need to collect some information about their reason for leaving. I'm using Contact Form 7 to collect the info, and want to use a hook to delete the user.

When I use the function below, I receive an email with the info from the form, but it doesn't delete the user.

function outta_here() {

    global $current_user;
    $delete_me = get_currentuserinfo();

add_action( 'wpcf7_before_send_mail', 'outta_here' );

closed as off-topic by Johannes Pille, Pieter Goosen, birgire, fuxia Jul 28 '14 at 7:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.


You're doing it wrong. get_currentuserinfo() returns the data into some preset global variables. Try this:

function outta_here() {

    global $user_ID;

add_action( 'wpcf7_before_send_mail', 'outta_here' );

You can read more about get_currentuserinfo() on WP Codex.

Not the answer you're looking for? Browse other questions tagged or ask your own question.