2
Contributors
2
Replies
13
Views
2 Years
Discussion Span
Last Post by ravi142
0

But there is approve_user function exits and there is wp_mail function inside itwhich fire when admin approve user? if i got you correct?

Edited by mangel.murti: clearify

0

Yes.

public function approve_user( $user_id ) {
        $user = new WP_User( $user_id );

        wp_cache_delete( $user->ID, 'users' );
        wp_cache_delete( $user->data->user_login, 'userlogins' );

        // send email to user telling of approval
        $user_login = stripslashes( $user->data->user_login );
        $user_email = stripslashes( $user->data->user_email );

        // format the message
        $message = nua_default_approve_user_message();

        $message = nua_do_email_tags( $message, array(
            'context' => 'approve_user',
            'user' => $user,
            'user_login' => $user_login,
            'user_email' => $user_email,
        ) );
        $message = apply_filters( 'new_user_approve_approve_user_message', $message, $user );

        $subject = sprintf( __( '[%s] Registration Approved', 'new-user-approve' ), get_option( 'blogname' ) );
        $subject = apply_filters( 'new_user_approve_approve_user_subject', $subject );

        // send the mail
        wp_mail( $user_email, $subject, $message, $this->email_message_headers() );

        // change usermeta tag in database to approved
        update_user_meta( $user->ID, 'pw_user_status', 'approved' );

        do_action( 'new_user_approve_user_approved', $user );
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.