Extend Simple Survey to store fe_user

Simple Survey is great extension that allows you to create simple surveys for your visitors. Extension is well written but was missing one tiny feature, ability to store information about currently logged in user taking the survey.

However, this can be easily fixed.

First we need to extend answers table to store currently logged in user:

CREATE TABLE tx_simplesurvey_answers (
feuser_id int(11) DEFAULT '0' NOT NULL,

and store current fe_login user ID in that field:


$insertArr = array( "crdate" => $crdate,
"surveyuid" => $surveyuid,
"userdatauid" => intval($userdatauid),
"answer" => $GLOBALS['TYPO3_DB']->fullQuoteStr($content, 'tx_simplesurvey_answers'),
"feuser_id" => $GLOBALS['TSFE']->fe_user->user['uid'] );
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_simplesurvey_answers', $insertArr);