Welcome to the LimeSurvey Community Forum

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

LimeSurvey Plugin Hello World

  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago #128876 by codelogic
LimeSurvey Plugin Hello World was created by codelogic
I have been working on trying to make a hello world plugin for hours. I don't mind reading but I can't find enough documentation on the subject. If someone can help me through this perhaps I can write something for the docs to help anyone else who gets stuck at this point.

I was trying to make a plugin that would change all the question hints to read "Hello World".
Code:
<?php
    class HelloWorld extends \ls\pluginmanager\PluginBase{
 
        static protected $description = 'test 4';
        static protected $name = 'Hello World';
 
 
        public function init() {
            $this->subscribe('BeforeQuestionRender');
        }
 
        public function beforeQuestionRender(){
            $this->getEvent()->set('questionhelp', 'Hello World');
        }
 
    }
?>

Questions
- What am I doing wrong
- More importantly where can I read more about events and how to use them.
- What keys events have at there disposal or where in the source code is a good place to find what keys an event talks to? (This is based of the assumption that one uses hashmap manipulations to get things done in plugins).
The following user(s) said Thank You: unclemosaic
The topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago #128877 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World

codelogic wrote: - What keys events have at there disposal or where in the source code is a good place to find what keys an event talks to? (This is based of the assumption that one uses hashmap manipulations to get things done in plugins).


Correction:
- What keys can events access or where in the source code is a good place to find all the possible options an event has access to (This is based of the assumption that key/value structures are used to get things done in limesurvey plugins).
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 4 months ago - 8 years 4 months ago #128980 by DenisChenu
Replied by DenisChenu on topic LimeSurvey Plugin Hello World
Hi,

Quickliy look at your plugin : seems OK . Did you activate it ?

It's in directory HelloWorld and file name is HelloWorld.php (plugins/HelloWorld/HelloWorld.php)

Start with a die("Hello world") to track down where you are.

PS: this one git.framasoft.org/SondagePro-LimeSurvey-...cessibility.php#L432 does the job.

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: 8 years 4 months ago by DenisChenu.
The topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago #128987 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World

DenisChenu wrote: Hi,

Quickliy look at your plugin : seems OK . Did you activate it ?

It's in directory HelloWorld and file name is HelloWorld.php (plugins/HelloWorld/HelloWorld.php)

Start with a die("Hello world") to track down where you are.

PS: this one git.framasoft.org/SondagePro-LimeSurvey-...cessibility.php#L432 does the job.


Last night I found that I capitalized the first letter of the event. :pinch: so the correct way would be as follows
$this->subscribe('beforeQuestionRender');
Thanks for the die() trick I will use that in the future. I appreciate the pointer on where to look in the code. I'm going to type up a hello world intro for plugins should I post it on a personal BLOG or can you guys use it for the lime survey website?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 4 months ago #128989 by DenisChenu
Replied by DenisChenu on topic LimeSurvey Plugin Hello World

codelogic wrote: Last night I found that I capitalized the first letter of the event. :pinch: so the correct way would be as follows
$this->subscribe('beforeQuestionRender');

Right , must be in manual .... due to mediawik the title are capitalized ... in the manual ...

codelogic wrote: Thanks for the die() trick I will use that in the future. I appreciate the pointer on where to look in the code.

Die is really the bad way ;) . You can use tracevar() or Yii trace system too.

codelogic wrote: I'm going to type up a hello world intro for plugins should I post it on a personal BLOG or can you guys use it for the lime survey website?

Go! go ! for a forum post !
ANd you can put your forum post at manual.limesurvey.org/Available_third_party_plugins (maybe need a demo plugin sub title).

Denis

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 topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago #129030 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World
I'll need to read about Yii. I want to contribute code when time permits but things have been hectic.
The topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 4 months ago - 8 years 4 months ago #129133 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World

DenisChenu wrote: Go! go ! for a forum post !
ANd you can put your forum post at manual.limesurvey.org/Available_third_party_plugins (maybe need a demo plugin sub title).


I tried to post the Hello World tutorial that I make but it said "You have to many links in your message, please decrease it". I'm guessing it had to do with all the pictures I have which link to an external website. I just posted it on my blog for now. Maybe we can migrate it to the website some other time.
LimeSurvey plug-in hello world tutorial
I hope this makes plug-in creation faster and less painful for new comers.
Last edit: 8 years 4 months ago by codelogic.
The following user(s) said Thank You: DenisChenu, Ben_V
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 4 months ago #129135 by DenisChenu
Replied by DenisChenu on topic LimeSurvey Plugin Hello World
Hi,

I mean blog post :).

Added in manual.limesurvey.org/Available_third_pa...ple_and_demo_plugins (remind our manual is a wiki).

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: Ben_V
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 years 2 months ago #131884 by Mazi
Replied by Mazi on topic LimeSurvey Plugin Hello World
Thanks for sharing your explanations to help others. Since most users start looking at the available documentation at the Limesurvey manual, can you please add the "Hello World" details at manual.limesurvey.org/Plugins ?

Just ping me if you need help with this but it would be very helpful and a good start for others.

Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 1 month ago #133002 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World

Mazi wrote: Thanks for sharing your explanations to help others. Since most users start looking at the available documentation at the Limesurvey manual, can you please add the "Hello World" details at manual.limesurvey.org/Plugins ?

Just ping me if you need help with this but it would be very helpful and a good start for others.

Thanks!


I would like to do this. I've been slammed lately but I'm hoping to get to it when I have some free time.
The topic has been locked.
More
7 years 6 months ago #142489 by teracomp
Replied by teracomp on topic LimeSurvey Plugin Hello World
This looks like an interesting topic, but the link to the Hello World post does not work.
Database Error
Error establishing a database connection

Dave Phillips
The topic has been locked.
  • codelogic
  • codelogic's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 6 months ago #142721 by codelogic
Replied by codelogic on topic LimeSurvey Plugin Hello World
I'm so sorry I deleted my blog but I forgot there was something useful for this website. My apologies. We should probably delete this thread all together if possible.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose