Welcome to the LimeSurvey Community Forum

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

Disable or remove particular question types

  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 8 months ago - 2 years 8 months 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: 2 years 8 months ago by tassoman. Reason: fixed typo
The topic has been locked.
  • tassoman
  • tassoman's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 8 months ago - 2 years 8 months ago #218938 by tassoman
Replied by tassoman on topic Disable or remove particular question types
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: 2 years 8 months ago by tassoman.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose