• There’s the function:

    /**
    * Admin approval of user
    *
    * @uses new_user_approve_approve_user
    */
    public function approve_user( $user_id ) {
    $user = new WP_User( $user_id );

    // password should only be reset for users that:
    // * have never logged in
    // * are just approved for the first time

    // If the password has already been reset for this user,
    // $password_reset will be a unix timestamp
    $password_reset = get_user_meta( $user_id, ‘pw_user_approve_password_reset’ );

    // Get the current user status. By default each user is given a pending
    // status when the user is created (with this plugin activated). If the
    // user was created while this plugin was not active, the user will not
    // have a status set.
    $user_status = get_user_meta( $user_id, ‘pw_user_status’ );

    // Default behavior is to reset password
    $bypass_password_reset = false;

    // if no status is set, don’t reset password
    if ( empty( $user_status ) ) {
    $bypass_password_reset = true;
    }

    // if the password has already been reset, absolutely bypass
    if ( !empty( $password_reset ) ) {
    $bypass_password_reset = true;
    }

    $bypass_password_reset = apply_filters( ‘new_user_approve_bypass_password_reset’, $bypass_password_reset );

    if ( !$bypass_password_reset ) {
    global $wpdb;

    // reset password to know what to send the user
    $new_pass = wp_generate_password( 12, false );
    $data = array( ‘user_pass’ => md5( $new_pass ), ‘user_activation_key’ => ”, );
    $where = array( ‘ID’ => $user->ID, );
    $wpdb->update( $wpdb->users, $data, $where, array( ‘%s’, ‘%s’ ), array( ‘%d’ ) );

    // Set up the Password change nag.
    update_user_option( $user->ID, ‘default_password_nag’, true, true );

    // Set this meta field to track that the password has been reset by
    // the plugin. Don’t reset it again.
    update_user_meta( $user->ID, ‘pw_user_approve_password_reset’, time() );
    }

    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 = sprintf( __( ‘You have been approved to access %s’, ‘new-user-approve’ ), get_option( ‘blogname’ ) ) . “\r\n”;
    $message .= sprintf( __( ‘Username: %s’, ‘new-user-approve’ ), $user_login ) . “\r\n”;
    if ( !$bypass_password_reset ) {
    $message .= sprintf( __( ‘Password: %s’, ‘new-user-approve’ ), $new_pass ) . “\r\n”;
    }
    $message .= wp_login_url() . “\r\n”;

    $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 );
    }

    I want to edit the approval message, but I don’t want to change it in the plugin file. Is there a function I can add to edit this message?

The topic ‘[Plugin: New User Approve] Editing the Approved message’ is closed to new replies.