- Posts: 21
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Access Plugin through URL
- Dennis
- Topic Author
- Offline
- Junior Member
Less
More
2 years 8 months ago #218581
by Dennis
Access Plugin through URL was created by Dennis
Hi, I would like to use an URL for a plugin, for example something like limesurvey.mydomain.org/myplugin?option=Y
Is this possible? And if so, what event to use?
Is this possible? And if so, what event to use?
Please Log in to join the conversation.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13644
- Thank you received: 2491
2 years 8 months ago #218622
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Access Plugin through URL
Via
manual.limesurvey.org/Plugin_events
manual.limesurvey.org/NewDirectRequest
and
manual.limesurvey.org/NewUnsecureRequest if you need POST value from an external website.
manual.limesurvey.org/NewDirectRequest
and
manual.limesurvey.org/NewUnsecureRequest if you need POST value from an external website.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: tassoman
Please Log in to join the conversation.
- tassoman
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
2 years 2 months ago #225479
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic Access Plugin through URL
Ciao Denis,
using NewDirectRequest is for building public pages/routes? How can I check ACL for super-admins backend? I just set an url /admin/mypluginpage ?
using NewDirectRequest is for building public pages/routes? How can I check ACL for super-admins backend? I just set an url /admin/mypluginpage ?
«All your survey answers are belong to us »
Please Log in to join the conversation.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13644
- Thank you received: 2491
2 years 2 months ago #225481
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Access Plugin through URL
For admin page :
github.com/LimeSurvey/LimeSurvey/blob/ma...min/PluginHelper.php
Sample usage (with surveyId)
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L292
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L378
Best is to allow only needed method : see github.com/LimeSurvey/LimeSurvey/blob/56...r/PluginBase.php#L65
Sample usage (with surveyId)
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L292
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L378
Best is to allow only needed method : see github.com/LimeSurvey/LimeSurvey/blob/56...r/PluginBase.php#L65
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: tassoman
Please Log in to join the conversation.
- tassoman
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
2 years 2 months ago #225489
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic Access Plugin through URL
Thank you for the examples, I study on it.
I want to release a plugin for blacklisted IPs view and management. And session count.
(for example "there are XY responders online, SZ administrators)
I want to release a plugin for blacklisted IPs view and management. And session count.
(for example "there are XY responders online, SZ administrators)
«All your survey answers are belong to us »
Please Log in to join the conversation.
- tassoman
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
2 years 1 month ago - 2 years 1 month ago #225791
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic Access Plugin through URL
Denis, I followed your hint and I manage to build a superuser admin link, binding a method to the pluginhelper route.
I created a "views" folder with a twig file in it, but I have this exception:
I'm trying:
Looks like I've triggered the wrong controller?
I created a "views" folder with a twig file in it, but I have this exception:
"AdminController cannot find the requested view "plugin_views_folder3.views.testPage"
I'm trying:
Code:
public funtion pageTest() { return $this->renderPartial('testPage', array() , true); }
Looks like I've triggered the wrong controller?
«All your survey answers are belong to us »
Last edit: 2 years 1 month ago by tassoman.
Please Log in to join the conversation.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13644
- Thank you received: 2491
2 years 1 month ago #225793
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Access Plugin through URL
I don't use twig for admin
But to use twig : you need to register to getPluginTwigPath
See: gitlab.com/SondagesPro/managament/respon...tAndManage.php#L2227 for a complete page.
WARNING : i have some issue currently with Login page by survey in some condition n(hard to find …)
But to use twig : you need to register to getPluginTwigPath
See: gitlab.com/SondagesPro/managament/respon...tAndManage.php#L2227 for a complete page.
WARNING : i have some issue currently with Login page by survey in some condition n(hard to find …)
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Please Log in to join the conversation.
- tassoman
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
2 years 1 month ago - 2 years 1 month ago #225795
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic Access Plugin through URL
I got things done like this:
«All your survey answers are belong to us »
Last edit: 2 years 1 month ago by tassoman.
Please Log in to join the conversation.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13644
- Thank you received: 2491
2 years 1 month ago #225799
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Access Plugin through URL
It work ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Please Log in to join the conversation.
- tassoman
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
2 years 1 month ago #225811
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic Access Plugin through URL
Yes, it works!
But now I'm unable to load custom CSS and JS ...
I will publish a full working plugin useful to monitor banned IP addresses and current sessions statistics, people voting, admins loggedin ...
But now I'm unable to load custom CSS and JS ...
I will publish a full working plugin useful to monitor banned IP addresses and current sessions statistics, people voting, admins loggedin ...
«All your survey answers are belong to us »
Please Log in to join the conversation.
- Dennis
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
2 years 1 month ago - 2 years 1 month ago #225878
by Dennis
Replied by Dennis on topic Access Plugin through URL
Hhhm, I just can't get it to work. My code is very basic:
The plugin is loaded and I expected to access it at the URL limesurvey/index.php/plugins/ShowAnswers, but get a "The system is unable to find the requested action "ShowAnswers".
It must be something pretty basic, any ideas?
Code:
<?php class ShowAnswers extends PluginBase { static protected $description = 'Show answers'; static protected $name = 'ShowAnswers'; public function init() { $this->subscribe('newDirectRequest'); } public function newDirectRequest() { $this->api->createUrl('plugins/direct', array('plugin' => 'ShowAnswers', 'function' => 'action')); } public function action() { echo "We've started!"; } }
The plugin is loaded and I expected to access it at the URL limesurvey/index.php/plugins/ShowAnswers, but get a "The system is unable to find the requested action "ShowAnswers".
It must be something pretty basic, any ideas?
Last edit: 2 years 1 month ago by Dennis.
Please Log in to join the conversation.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13644
- Thank you received: 2491
2 years 1 month ago - 2 years 1 month ago #225880
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Access Plugin through URL
Why use newDirectRequest to show a link ?
Url can be
(see
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L354
)
Best is to use beforeToolsMenuRender
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L321
Url can be
Code:
limesurvey/index.php/plugins/direct/plugin/ShowAnswers
Best is to use beforeToolsMenuRender
gitlab.com/SondagesPro/managament/respon...stAndManage.php#L321
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 2 years 1 month ago by DenisChenu.
Please Log in to join the conversation.