Can anyone tell what changes are needed to be able to resend invitation codes without having them updated? The idea is to send a reminder to the invitee, but not change his currently existing code.
I took a peek at edit.survey.class.php and it seems that line 2351 onwards updates the invitee code (takes a lot of skill reading the comment
Anyway, I did add the requirement of being empty to the update SQL statement (added "and invite_code is null") - and that works, in the sense that existing codes are not overwritten. Problem is that the mail sends the wrong invitation code (the one that would have been written on the database, I guess).
Any idea how to change the coding in a way that it just creates a invite code for invitees that don't already have it, sending to all selected invitees the correct ones?
TIA
Regards,
Rui
Edit
Well, pretended being a programmer and did the following:
Original code (line 2351 of edit.survey.class.php)
CODE
//Update user information to include the code that was chosen
if($code)
{
$query = "UPDATE {$this->CONF['db_tbl_prefix']}users SET invite_code = {$dbcode} WHERE sid=$sid AND uid=$uid";
$rs = $this->db->Execute($query);
if($rs === FALSE)
{ $this->error("Error updating invitation code for invitee (uid:$uid): " . $this->db->ErrorMsg()); return FALSE; }
}
return $code;
New crappy dirty untested code that seems to do the trick
CODE
//Update user information to include the code that was chosen
if($code)
{
$query = "UPDATE {$this->CONF['db_tbl_prefix']}users SET invite_code = {$dbcode} WHERE sid=$sid AND uid=$uid and invite_code is null";
$rs = $this->db->Execute($query);
if($rs === FALSE)
{ $this->error("Error updating invitation code for invitee (uid:$uid): " . $this->db->ErrorMsg()); return FALSE; }
$query = "SELECT invite_code FROM {$this->CONF['db_tbl_prefix']}users WHERE sid=$sid AND uid=$uid";
$result = mysql_query($query);
list($code) = mysql_fetch_row($result);
}
return $code;
Didn't test it much, probably there are quite a few better ways to do the same thing (if it does at all), but anyway it was the 1st time I edited a php file
P.S. - Grats John for you newborn