- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Add column to "responses" table of survey with a plugin
- Miratek
- Topic Author
- Offline
- New Member
Less
More
1 year 8 months ago #231217
by Miratek
Add column to "responses" table of survey with a plugin was created by Miratek
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 5.3.14+220516
Own server or LimeSurvey hosting: Own Server
Survey theme/template: -
==================
Hey guys,
I'm developing a plugin. If an user participates on the survey, I can see all the responses on the page "responses" in a table (with columns like "completed" etc.).
But I want to write additional information to the database so the table shows another custom column, e.g. "successful" where PHP should define if a user gets a true or false (based on some variables).
My approach is to use the afterSurveyComplete-Event. I can already show the responses via $this->pluginManager->getAPI()->getResponse($surveyId, $responseId);
But how can I set an additional variable there? How to write data to the database?
Greetings!
Your LimeSurvey version: LimeSurvey Community Edition Version 5.3.14+220516
Own server or LimeSurvey hosting: Own Server
Survey theme/template: -
==================
Hey guys,
I'm developing a plugin. If an user participates on the survey, I can see all the responses on the page "responses" in a table (with columns like "completed" etc.).
But I want to write additional information to the database so the table shows another custom column, e.g. "successful" where PHP should define if a user gets a true or false (based on some variables).
My approach is to use the afterSurveyComplete-Event. I can already show the responses via $this->pluginManager->getAPI()->getResponse($surveyId, $responseId);
But how can I set an additional variable there? How to write data to the database?
Greetings!
Please Log in to join the conversation.
- tammo
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 967
- Thank you received: 220
1 year 8 months ago #231219
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Add column to "responses" table of survey with a plugin
To add a new column to your responses tabel, you can also add a hidden question (text) with the question code "succesful"
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Please Log in to join the conversation.
- Miratek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 year 8 months ago #231226
by Miratek
Replied by Miratek on topic Add column to "responses" table of survey with a plugin
That would be possible, yes. But I want that a limesurvey survey creator only needs to install my plugin and do not alter its survey (by adding additional questions).
Is there another way?
Is there another way?
Please Log in to join the conversation.
- tammo
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 967
- Thank you received: 220
1 year 8 months ago #231229
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Add column to "responses" table of survey with a plugin
Well, yes, but then you would indeed need a plugin.
I am not good at that, possibly one of the other experts that hang around here may be able to help you.
Tammo
I am not good at that, possibly one of the other experts that hang around here may be able to help you.
Tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Please Log in to join the conversation.
- Miratek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 year 8 months ago #231236
by Miratek
Replied by Miratek on topic Add column to "responses" table of survey with a plugin
Thank you for your answers!
Yes indeed, my whole topic is about me developing a plugin
Yes indeed, my whole topic is about me developing a plugin
Please Log in to join the conversation.