WordPress.org

Forums

Invite Friends to Register
Fails when sending multiple invitations (9 posts)

  1. davidelbert
    Member
    Posted 2 years ago #

    If I want to invite a list of friends at once, I use the "+" button to add extra rows to the entry form. But when I then send the invitations, they all go to one email address instead of the whole list.

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

  2. Kash
    Member
    Posted 2 years ago #

    I have the same problem. did you find a solution?

  3. davidelbert
    Member
    Posted 2 years ago #

    Never found a solution. Sorry. I haven't tried it since some updates so I can check when I get a chance, but I don't have a lot of hope.

    If you ever find a solution I hope you return here and let me know!

  4. ericreynolds007
    Member
    Posted 1 year ago #

    Thanks for the plugin Tammy! :)

    I commented out the + and - links in /invite-friends-to-register/inc/inviteform.php so that only one invitation sends at a time. :p

  5. adrianviz
    Member
    Posted 1 year ago #

    Hi Eric,
    Can you please let me know the code or how exactly you commented out the + and i so that only one invitation sends at a time.

    Thanks!

  6. ericreynolds007
    Member
    Posted 1 year ago #

    Certainly. The affected lines of code are in /plugins/invite-friends-to-register/inc/inviteform.php

    To remove the + link, comment out line 76, surrounding the code with <!-- and -->
    <!-- <th><a class="invfr_add button" href="#">+</a></th> -->

    To remove the - link, comment out line 88, surrounding the code with <!-- and -->
    <!-- <td><a class="invfr_remove button" href="#">-</a></td> -->

    I hope this helps.

    :) Eric

  7. adrianviz
    Member
    Posted 1 year ago #

    Eric,
    Thank you so much! Your solution works beautifully.

    There is one thing that may be useful to you as well. Now that we removed +/- it should be possible to do.

    Problem i am running into is that our site is fully responsive to take advantage of different screen sizes. Like most modern wordpress themes these days.

    However when Invite Friends plugin is viewed on a smaller screen for example on the iPhone in portrait view plugin does not adjust its width to fit the smaller screen.

    Hence the solution would be to have Friend's Email field below Friend's name. This would it would look perfectly even on small screens in portrait view.

    So you would have:
    Friend's Name
    Friend's Email
    (Send Invitation Button)

    In general i think this would be helpful to users.

    Thank you so much again.

    Adrian

  8. ericreynolds007
    Member
    Posted 1 year ago #

    A few code tweaks and you're there...

    In the same file, inviteform.php, line 71

    Replace <table class="form-table"> with <table> to remove the form-table CSS

    Then, deactivate the table header by commenting it out as follows. Note that you will have to remove the opening and close comment out tags from the "+ link" line of code I mentioned in my last reply above. Otherwise, you'll have conflicting tags.

    <!-- Comment out the table header
    	<thead>
    		<tr>
    			<th><?php _e( 'Friend’s Name', 'invfr' ); ?></th>
    			<th><?php _e( 'Friend’s Email', 'invfr' ); ?></th>
    			<th><a class="invfr_add button" href="#">+</a></th>
    		</tr>
    		</thead>
    End table head comment out -->

    Next, you'll want to remove the second (right) table column by adding tags. Then, you will add the new field labels (Friend's Name and Email) within the following code...

    <td valign="top"><label for="friend_name-0" class="screen-reader-text"><?php _e( 'Friend’s Name', 'invfr' ); ?></label>
    	<p><strong>Friend’s First Name</strong></p>
    		<input type="text" name="friend_name[0]" id="friend_name-0" value="" />
    		<span class="error-msg"><?php _e( 'Enter your friend’s name', 'invfr' ); ?></span>
    	</td>
    	<td valign="top"><label for="friend_email-0" class="screen-reader-text"><?php _e( 'Friend’s Email', 'invfr' ); ?></label>
    	<p>Friend’s Email Address</strong></p>
    		<input type="email" name="friend_email[0]" id="friend_email-0" value="" />
    		<span class="error-msg"><?php _e( 'Enter a valid email address', 'invfr' ); ?></span>
    	</td>
    	<!-- <td><a class="invfr_remove button" href="#">-</a></td> -->
    </tr>
    </table>

    To finish up, you'll need to use a web inspector like Firebug to remove table borders and adjust styles. I added some padding between the email input field and my table's bottom border.

    I hope this helps.

    :) Eric

  9. MohamedNizzad
    Member
    Posted 1 year ago #

    The fix to send multiple invitations

    Hi, this is my first entry into wordpress support although well experienced.

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Invite Friends to Register
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic