WordPress.org

Ready to get started?Download WordPress

Forums

Invite Friends to Register
Only sending to last e-mail entered. (2 posts)

  1. rboord
    Member
    Posted 8 months ago #

    I've been using this plugin for a while. Out of nowhere the plugin started only sending to whatever the last e-mail address entered.

    I tried the plugin on a fresh install on a different server, and had the same problem.

    http://wordpress.org/plugins/invite-friends-to-register/

  2. MohamedNizzad
    Member
    Posted 8 months ago #

    The fix to send multiple invitations

    Following is the simple fix, Just putting the wp_mail at the right place :)

    sendmail.php

    Simply put the following code instead of the one there.

    <?php
    add_action( 'wp_ajax_invfr_process_ajax', 'invfr_sendmail');
    add_action( 'wp_ajax_nopriv_invfr_process_ajax', 'invfr_sendmail');
    function invfr_sendmail() {
    $post = ( !empty( $_POST ) ) ? true : false;

    if( $post ) {
    $subject = invfr_get_settings( 'subject' );
    $message = invfr_get_settings( 'message' );
    $friends = $_POST['friend_email'];
    $errors = array();

    foreach ( $friends as $key => $friend ) {
    $name = stripslashes( $_POST['friend_name'][$key] );
    $email = trim( $_POST['friend_email'][$key] );

    // Check name
    if( !$name )
    $errors[] = '#friend_name-' . $key;

    if( !$email )
    $errors[] = '#friend_email-' . $key;

    if( $email && !is_email( $email ) )
    $errors[] = '#friend_email-' . $key;

    $mail = wp_mail( $email, invfr_tokens_replacement( $subject, $_POST, $key ), invfr_tokens_replacement( $message, $_POST, $key ) );
    }

    //send email
    if( !$errors )
    {
    if( $mail )
    echo 'sent';
    }
    else
    echo json_encode( $errors );

    }
    }
    ?>

    My deepest appreciation to the developer of this plugin.
    Mohamed

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.