MohamedNizzad
Forum Replies Created
-
Forum: Plugins
In reply to: [Invite Friends to Register] Only sending to last e-mail entered.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.
MohamedForum: Plugins
In reply to: [Invite Friends to Register] Fails when sending multiple invitationsThe 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