Welcome to the LimeSurvey Community Forum

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

Access Limesurvey per user / per survey data from Wordpress via API interface

  • linuxhooligan
  • linuxhooligan's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 months 2 weeks ago - 8 months 2 weeks ago #257485 by linuxhooligan
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 5.6.55+240220
Own server or LimeSurvey hosting: self hosted
Survey theme/template: Fruity
==================
We have successfully developed a number of surveys on the 5.x version and are really impressed by the capabilities of the system.  The ExpressionScript feature allows us to even create some basic reports and display results using Chartjs.  

We are now getting a bit more ambitious.  I would like to explore the following.

1) We have a Wordpress membership site.  Each user has their own account and their own per user content on the site.

2) We run Limesurvey on the same server and it is local to the Wordpress instance.

3) We would like to explore integration possibilities between Wordpress and Limesurvey.  Some thoughts:

a) Can Wordpress users "somehow" be integrated with Limesurvey so that when a user logs into their Wordpress account, they can take a survey and those results are stored in a way that are unique to that Wordpress user?  What might be required for the integration to be automated so that whenever a new user is added to the Wordpress site the integration treats them as a unique user on the Limesurvey system?

Note: I am reading up on Tokens / Survey Participants as per:  www.limesurvey.org/manual/Survey_participants/en

I am looking for the big picture explanation on how to think about what is possible and how this might be done.  Also, I have Googled this question many times over the last while but no one seems to actually integrate Wordpress with Limesurvey in any significant way.

b) If per user integration from Wordpress is possible, could we access the users results via the API (or other?) interfaces from Wordpress and display the data directly in Wordpress?  If yes, would a user be able to fill out the survey multiple times and would we be able to query the historical survey data to analyze trends?

I am reading through the Remote Control API documentation here:  www.limesurvey.org/manual/RemoteControl_2_API

As per above, I am looking for high level opinions on if this can be done and how to think about it, perhaps suggestions on what else I should read, etc.

SUMMARY: We are really amazed by Limesruvey and love that it acts ONLY as a survey platform and does not try to add on reporting or other specialized tools.  We have also recently become quite enamored with Wordpress (and it's ecosystem) especially with the speed on hosts that do hosting right.  I am wanting to explore the potential for Wordpress to act as a kind of frontend for the data that Limesurvey hosts and stores.  There are plenty of API and reporting plugins, it feels like this should be fairly doable.

With apologies for rambling, any thoughts comments or critiques are welcome.  I am not looking for any handholding, just an expert "we have done this successfully, hey look at think, think about it this way, this is possible / this isn't, look over there for more info" bit picture guidance so I can get a better handle on how something like this might work.

Thanks!
Last edit: 8 months 2 weeks ago by linuxhooligan.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 2 weeks ago - 8 months 2 weeks ago #257498 by holch

What might be required for the integration to be automated so that whenever a new user is added to the Wordpress site the integration treats them as a unique user on the Limesurvey system?


Your concept of "users" in limesurvey seems to wrong. "Users" in the sense of "respondents" do not have a login in Limesurvey. Login is only for "users" in the sense of "Survey admins", people with access to the LS backend who can create surveys, etc.

the only thing that is getting somehow close to a login for survey takers is the token / participant system. But this is also on a per survey basis and not really on a "user/token/participant" basis. So this part of the equation you would have to do in Wordpress.

I am not an expert on this type of work, but I imagine you could give each of your users a specific token, used by them in all surveys that they are taking. As token you could for example use their membership ID or something.

The rest of all you describe would have to happen on Wordpress from the members page, where you query limesurvey via the API and check for which surveys there is data for a specific member.

And yes, they could fill in the survey various times, if you allow so (keyword uses left). You would then have to see how to get the different data sets (and timestamps) via API for this specific user. From my limited knowledge this should be doable via the API, but I am sure Tpartner and Denis can give you more insights. They might actually be available for hiring to implement this for you (they are Limesurvey Partners).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 8 months 2 weeks ago by holch.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 2 weeks ago #257503 by tpartner

...(they are Limesurvey Partners).
Not me. :)

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.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 2 weeks ago #257505 by holch

Not me. :)


Ohh, I was under the impression. Now I know!

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • linuxhooligan
  • linuxhooligan's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
8 months 2 weeks ago #257650 by linuxhooligan
Just dropping back in her to forward my thank you for your reply. I had to think through this a bit as you were right, my understanding of Limesruvey memberships was wrong and your explanation helped me visualize some of the mechanics here.

I appreciate the help and if we manage to get anything useful happening we might look at contributing it, even if it is just knowledge.

Thank you.

Please Log in to join the conversation.

More
5 months 1 hour ago #265269 by Vetgans

a) Can Wordpress users "somehow" be integrated with Limesurvey so that when a user logs into their Wordpress account, they can take a survey and those results are stored in a way that are unique to that Wordpress user?  What might be required for the integration to be automated so that whenever a new user is added to the Wordpress site the integration treats them as a unique user on the Limesurvey system?
 
I'm looking for exactly the same possibilities as you, linuxhooligan . Did you make any progress on this?
If so, could you please give some pointers on what you've done?

Please Log in to join the conversation.

  • linuxhooligan
  • linuxhooligan's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 months 2 weeks ago #265529 by linuxhooligan
Vertgans, just dropping in to let you know that we have not had the time to pay attention to this just yet.

I may actually get our team to review this soonish.

Are you working on this your self? Is it a larger project with a budget? Perhaps there might be room for collab on something like that as I am sure we aren't the only ones running into the need for WP + Lime per user integration.

I have confirmed that the most powerful forms based plugin for Wordpress (Formidable Forms) cannot do everything that Limesurvey can and even if you extended it to be able to have a fraction of the features it would cost a huge amount. Limesurvey is so great at what it does that a plugin perhaps may be the most effective way forward. There was one I believe years ago but probably no one used it so it kind of went away I guess.

I would be curious to hear what you guys are working on and what the scope of your project might be though.

Please Log in to join the conversation.

More
4 months 2 weeks ago #265530 by jelo

There was one I believe years ago but probably no one used it so it kind of went away I guess.
 
There was a Wordpress addon names "Surveypress" to interact with LimeSurvey. That plugin was not developed by LimesSurvey GmbH, but later took the project into there hands. It was only fixed a bit, but never developed any further.
You can finde the codebase here and see the nonprogress.
github.com/LimeSurvey/surveypress

For tight integration with WordPress the costly form plugins (you name them all), are still the only way for selfhosting.
The Drupal project had some interesting form plugins but the market share of Drupal is very low and the complexity to maintain a Drupal installation is higher that when you use WordPress. If you still want to take a look:
www.drupal.org/docs/contributed-modules/webform
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 months 2 weeks ago - 4 months 2 weeks ago #265544 by DenisChenu
Seems webform is not compatible with the last version of drupal.

Framasoft goes to liberaforms.org/en

When they compare Surveys tools, about LimeSurvey

  • [url] www.limesurvey.org/fr [/url] : la référence en matière de logiciel libre d’enquête. Cependant, « enquête » ≠ « formulaire » ! LimeSurvey est un logiciel idéal si vous voulez réaliser une enquête de plusieurs dizaines ou centaines de questions, avec des embranchements, etc. Mais notre objectif avec Framaforms est de proposer une alternative à Google Forms, à savoir un logiciel simple à prendre en main, qui permet de publier son premier formulaire en 5mn chrono. Ce qui est très, très loin d’être le cas de LimeSurvey ;


deepls translation

    www.limesurvey.org/fr : the benchmark for free survey software. However, "survey" ≠ "form"! LimeSurvey is ideal if you want to create a survey with dozens or hundreds of questions, with branches and so on. But our aim with Framaforms is to offer an alternative to Google Forms, namely software that's easy to get to grips with, and that lets you publish your first form in 5 minutes flat. This is a far, far cry from LimeSurvey ;


source : framablog.org/2024/06/13/dorlotons2-des-...glisons/#liberaforms

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 4 months 2 weeks ago by DenisChenu.

Please Log in to join the conversation.

More
4 months 1 week ago #265690 by Vetgans
@ linuxhooligan , @ jelo and @ DenisChenu :

What i am working on is basically a one/two-man (hobby)project without a budget...

One of the first things we did was to look for a forms plugin for WordPress. But we quickly realised that not only would it cost a lot of money to go that route, as @ linuxhooligan also points out, but those plugins wouldn't even be suitable for our purposes. It would be almost impossible to make the forms exactly the way we want them. More importantly, the user data would have to go through a third party. And that's a no-go for us, in terms of privacy and becoming dependent on them.

But luckily we have LimeSurvey. It is amazing software, we can create forms and surveys exactly the way we want. There's so many possibilities, you can tweak almost anything to your liking, it's awesome.
We're looking to use WordPress as the base for the website, mainly because it's one of the most popular pieces of software for creating a website, so there are lots of plugins available. It's relatively easy to integrate a forum into it. When looking for plugins to integrate LimeSurvey as well, we only found the old, outdated ones mentioned above.

About surveys: There are individual/personal surveys and anonymous surveys. For the latter, there is no need to create a participants table.
For a one-off individual/personal survey, it is probably sufficient to provide a personal link to an 'external' website, a LimeSurvey instance that is not integrated into the website. A one-time redirect to an external website is most often acceptable.
However, if you want people to fill out a form or survey on a regular basis, you need to integrate it seamlessly into the website. And that means integrating or linking the user accounts of that website to the participants table in LimeSurvey.
You cannot ask a user who is already logged in to a website to log in again (to LimeSurvey) within the same website, to take a survey or fill out a form. That would be unexpected at best, but more likely confusing and even annoying. It's not logical and it completely ruins a good user experience.

A simple example, a website for an athletics club:
Once logged in, each club member should be able to enter their results into a form after a meet or competition, without having to log in once more. You don't want them to have to log in again (in the LimeSurvey part) if they are already logged in to the website. And it almost goes without saying that you want to link those results to that particular user ('participant'), for example to show each individual club member their personal progress over time. So for a good user experience, LimeSurvey needs to be seamlessly integrated.

Maintaining an 'install and click' plugin that allows this is often a lot of work, so it wasn't really a surprise to find out that the existing ones were outdated. Ideally LimeSurvey would provide an official plugin, but you can't expect everything to be perfect.
However, i had hoped to see a WIKI page or clear instructions on how to achieve some sort of integration between a WordPress user database and a LimeSurvey participants table. Of course, i have searched and read about tokens, API 's, session keys and functionality as 'add_limesurvey_participant', but getting things to actually work is quite challenging for a non-developer, to say the least.
WordPress is widely used, so it would be great if there was more information available on how to integrate LimeSurvey into it.
This is often required for non-anonymous and personal surveys, so it would help a lot of people if there was some sort of step-by-step guide.

Please Log in to join the conversation.

More
1 week 8 hours ago #267738 by Ruif
Two remarks:

1.
Did you ever consider to use Advanced Custom Fields. The plugin has a function acf_form() that shows a fieldgroup as a form in the front end. Any field available in ACF can be added to the form and fields can be displayed conditionally. Enough for simple surveys.

2.
I am working on a plugin that can (among other things) add a wordpress user as a participant to a survey. This can be done both by directly accessing the limesurvey database. You have to create a new database object: $lsdb = new wpdb($lsdb_user, $lsdb_passw, $lsdb_name, $lsdb_host); This makes available all $wpdb methods to $lsdb. The $lsdb->insert method can than be used to add a participant to the right participants table.

or by using the json-rpc interface. You can use the json-rpc function 'add_participants()' to add a wp-user to the right participant table. The procedure could be: use the json-rpc function 'get_participant_properties()' to get a partcipant by his email. If the participant does not exist add one by using the json-rpc function 'add_participants()'.

Please Log in to join the conversation.

More
2 hours 12 minutes ago #267855 by Vetgans

Two remarks:

1.
Did you ever consider to use Advanced Custom Fields.
I actually already use that plugin for other functionality. However, for our purposes it is just a bit to limited as a survey tool.

2.
I am working on a plugin that can (among other things) add a wordpress user as a participant to a survey.

Interesting. I'm actually a bit (just a bit) surprised that there isn't an official plugin for Wordpress from Limesurvey. Of course it is understandable to put more effort in Limesurvey itself, but Wordpress is very widely used and therefore such a plugin would increase the use of Limesurvey as well.
Please give us a heads up if you're making progress!

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose