Ok, so now I have spent a few hours on this issue, I have come up with this solution so far.
First I added a new custom question as “Private” I found that the name of the form field displayed for this question is “mainquestion4”.
I then added
‘$ipaddress = $_SERVER[“REMOTE_ADDR”];’ to the top of rsvp_frontend.inc.php (right after <?php)
and added
‘$form .= ” <input type=\”hidden\” name=\”mainquestion4\” value=\”$ipaddress\” />\r\n”;’
to the list of hidden form fields in the same file.
I know that my hidden form field works because I tested it separately, but I cannot get the IP address to be added to the field.
I’m not very good with PHP, so any help would be appreciated. I think it may be a problem with the variable being global or local. Or could it be that I have used an incorrect code to grab the IP address?
$form = "<form id=\"rsvpForm\" name=\"rsvpForm\" method=\"post\" action=\"$rsvp_form_action\">\r\n";
$form .= " <input type=\"hidden\" name=\"attendeeID\" value=\"".$attendeeID."\" />\r\n";
$form .= " <input type=\"hidden\" name=\"rsvpStep\" value=\"handleRsvp\" />\r\n";
$form .= " <input type=\"hidden\" name=\"mainquestion4\" value=\"$ipaddress\" />\r\n";
$yesVerbiage = ((trim(get_option(OPTION_YES_VERBIAGE)) != "") ? get_option(OPTION_YES_VERBIAGE) :
__("Yes, of course I will be there! Who doesn't like family, friends, weddings, and a good time?", 'rsvp-plugin'));
$noVerbiage = ((trim(get_option(OPTION_NO_VERBIAGE)) != "") ? get_option(OPTION_NO_VERBIAGE) :
__("Um, unfortunately, there is a Star Trek marathon on that day that I just cannot miss.", 'rsvp-plugin'));
Dbh –
While I feel your pain, what good is having this person’s ip address going to do you?
I will be able to tell if someone is registering more than one guest with the same IP address. I may also be able to track them down.
Are you going to see the user’s IP address on their network, or the network’s IP address?
I added it to the rsvp_frontend.inc.php script;
On line 739 you will find this;
($sql = "SELECT firstName, lastName, rsvpStatus FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;)
Under this line I added 2 lines;
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
And under line 745 I added this;
$body .= "$ip | $browser";
This will send the IP-address and browser info in the notify e-mail.
nice, that worked great!
Couple notes/changes:
– using plugin version 1.7.5
– lines numbers didn’t matchup and also found 2 spots that matched what was noted on line 739. Of the two found I added it to the latter
– Added line breaks too: $body .= “\r\n\r\n $ip | $browser”;