Welcome to the LimeSurvey Community Forum

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

How to search for surveys with a custom parameter defined in the plugin_setting

  • rr6704
  • rr6704's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 day 16 hours ago #270221 by rr6704
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.10.2
Own server or LimeSurvey hosting: own
Survey theme/template: own
==================

A survey can have entries in the plugin_setting table. Such an entry can have a survey ID entered in the `madel_id` column, the `key` column can have the value `is_local`, and the `value` column can have `true`. 
I created a local administrator role and assigned this role to a user. I created several surveys. Some surveys have the entries described above in the plugin_settings table.
I need the user with the local administrator role to have access only to surveys defined as `is_local`/`true`.
Of course I want to do this in the plugin, but I don't know how to modify Survey/search/criteria.
Or maybe I should connect somewhere else?

I now have a solution that simulates handling criteria in the plugin, but I would like it to be a plugin, without changing the original code.

class Survey extends LSActiveRecord implements PermissionInterface
{

public function search($options = [])
{

Yii::import('xxx_survey_search.LocalSurveyAccess', true);
$lsa = new LocalSurveyAccess();
$lsa->beforeSurveySearch($criteria);

class LocalSurveyAccess /*extends PluginBase*/
{

public function beforeSurveySearch(& $criteria)
{

$criteria->addInCondition('t.sid', array_map('intval', $localSurveys)); 

I kindly ask for help or advice on how to search for surveys with a custom parameter defined in the plugin_setting table.

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose