I'm looping through all users with
$allusers = get_users($args); foreach ( $allusers as $user ):
And then I have an email user button (firstname and lastname are inserted into the subject), and a callback button (firstname and lastname are inserted into a hidden Contact Form 7 field)
The email link in my template is:
<a href="mailto:firstname.lastname@example.org?subject=<?php echo $user->first_name; ?> <?php echo $user->last_name; ?>">Email</a>
This works fine; it shows the correct user firstname and lastname in the loop. But the contact form field shows the last user in the loop, not the current one. This is what I have in my template:
I have used this for inserting a variable into a Contact Form 7: https://stackoverflow.com/questions/22943559/include-php-variable-in-contact-form-7-field
Why is my callback form variable displaying a different result to the email link variable, and how can I fix it?