RemoteControl add_participants problem

More
4 years 2 weeks ago #100415 by jday
jday created the topic: RemoteControl add_participants problem
Hello,

I'm having a problem using the RemoteControl2 function add_participants . Specifically, there seems to be a problem with passing the participant data parameter.

From what I gather from the manual and from the source of survey/application/controllers/admin/remotecontrol.php, this function expects the parameter to be a json-encoded array with keys that need to match the column names for this survey's specific token table. The manual shows a participant being added with just an email address, first name, and last name, so I'm attempting to add with this info. Like this: {"email":"me@example.com","lastname":"Bond","firstname":"James"}

The problem is that the function just returns the participant data parameter, no error, and does not insert a record into the table. Interestingly enough, if I call the function with badly formatted participant data, it will insert a record into the table with just a token and the table defaults.

Has anyone else run into this? Is anyone able to successfully use this function?

Thanks for your time!

Please Log in to join the conversation.

More
4 years 2 weeks ago #100423 by jday
jday replied the topic: RemoteControl add_participants problem
Ok, it turns out that I was just using this incorrectly.

instead of passing add_participants an array of user info, I wanted to pass it an array of arrays of user info.

So instead of:
$participantdata = array(
'email' => $email,
'lastname' => $last_name,
'firstname' => $first_name
);

I should have done something like:
$participantdata[] = array(
'email' => $email,
'lastname' => $last_name,
'firstname' => $first_name
);


My mistake, but I hope this helps anyone else having the same problem.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now