Thank you Denis,
I could not find your plugin but it did give me an idea that seems to have solved the problem I was having.
For the Panel Participants I have used a PHP page that uses the panel ID passed in the link for the token and then generates this entry into the token table and redirects to the survey with the newly created panel ID.
Then in the survey I have used routing logic to determine the source of the respondent and pass them through to relevant quota stops ... when the respondent is from a panel it uses a redirect there to send them back to the panel as screened out and when it is client sample it just closes.
The only issue I have now is the end page ... for the sample from client I want to display the close message on submission and for the panel I want to redirect via a URL on completion ... so 2 different outcomes after submission of a survey ...
Any thoughts on this??
Here is the PHP I used for the initial stages in case it helps anyone else .. the token is passed by adding ?pid=Token on the end of the url
Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once '../application/libraries/jsonRPCClient.php';
define( 'LS_BASEURL', 'https://yourserver/index.php'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'yourname' );
define( 'LS_PASSWORD', 'yourpassword' );
$iSurveyID = yoursurveyID;
$token = $_GET['pid']; ;
$email = 'xxx@xxx.com';
$FirstNameAPI = 'xxx' ;
$LastNameAPI = 'Panel' ;
// Instantiate a new RPC client
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/admin/remotecontrol' );
// Get a session key
$sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
// Define the token params
$tokenParams = array("email"=>$email,"lastname"=>$LastNameAPI,"firstname"=>$FirstNameAPI,"token"=>$token,"language"=>'en',"emailstatus"=>"OK","attribute_1"=>"2");
$aParticipantData=array($tokenParams);
$bCreateToken = false;
// Create the tokens
$newToken = $myJSONRPCClient->add_participants( $sSessionKey, $iSurveyID, $aParticipantData, $bCreateToken);
$newURL ="https://yourserver/index.php/survey/index/sid/yoursurveyID/token/".$token."/lang/en";
// Release the session key
$myJSONRPCClient->release_session_key( $sSessionKey );
header('Location: '.$newURL);
?>