I have a site that needs a redirect if a user tries to invite someone who is already a member. Instead of just showing an error I need it to redirect to /relationship/user id/request. How can I alter the following code to do that?
if (count($failed_emails)) {
$error = format_plural(count($failed_emails), 'The following recipient is already a member:', 'The following recipients are already members:') . '<br />';
foreach ($failed_emails as $key => $email) {
$account = user_load_by_mail($email);
$failed_emails[$key] = theme('username', array('account' => $account)) . ' (' . check_plain($email) . ')';
}
$error .= implode(', ', $failed_emails);
drupal_set_message($error, 'error');
}
}
thank you for your time.
Comments
Comment #1
DevJoshLopez commentedComment #2
DevJoshLopez commentedDoes anyone think this would be nicer then just an error saying the user is already on the site?
Comment #3
ckngMarked as duplicate of #1827624: redirect if failed