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 - 1 day 16 hours ago #270220 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.
Last edit: 1 day 16 hours ago by rr6704.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 day 15 hours ago #270224 by tpartner
Please do not double post.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose