Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Disable or remove particular question types

More
5 years 1 month ago - 5 years 1 month ago #218739 by tassoman
Can I disable Upload question type, removing it from the list of available questions?
I don't want Survey Administrator add Upload Questions to their surveys.

«All your survey answers are belong to us »
Last edit: 5 years 1 month ago by tassoman. Reason: fixed typo
The topic has been locked.
More
5 years 1 month ago - 5 years 1 month ago #218938 by tassoman
I wrote a plugin with this piece of code but is not working. Any idea how to disable Question Save event?
Code:
    public function beforeQuestionSave()     {         $event = $this->getEvent();         $model = $event->get('model');         $sQuestionType = $model->attributes['type'];         if ('|' == $sQuestionType) {             $event->set('success', false);             $event->set('message', 'Question type not allowed');         }     }

Writing $event->set('success', false) inside event beforeActivate, is enough for deny the activity. Looks like doesn't work the same in beforeQuestionSave hook event.

«All your survey answers are belong to us »
Last edit: 5 years 1 month ago by tassoman.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose