Welcome to the LimeSurvey Community Forum

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

Guidance on how to duplicate the user creation steps in a plugin

  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago #155741 by lintu
Howdy Folks,

I'm creating this post after doing some search on this topic and unable to find a solution. I need some assistance with a code sample for the specific requirement below:

I've a need to duplicate the user creation steps within a custom plugin that I'm creating. Basically, a view within the plugin to create a user with user ID, email and name. Then I would like to automatically assign this user to one specific survey ID and a token.

Appreciate it, if someone could offer some guidance with some code snippet. Thanks in advance.
The topic has been locked.
  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago - 6 years 9 months ago #155792 by lintu
I have made some progress on my end by creating the view and was able to create the user with the proper permissions in the database. Where I am stuck is the password creation. Can someone please help me understand how LimeSurvey encrypts the PW and how I can call the same function to achieve this.

Thanks
Last edit: 6 years 9 months ago by lintu.
The topic has been locked.
More
6 years 9 months ago - 6 years 9 months ago #155794 by Ben_V
Sorry, I can't answer exactly to your question.
BTW I think you should be interested by a similar process for token... Maybe api offers a way to create users as well

www.limesurvey.org/forum/can-i-do-this-w...api-add_participants
www.limesurvey.org/forum/can-i-do-this-w...icipants-to-a-survey

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 6 years 9 months ago by Ben_V.
The following user(s) said Thank You: lintu
The topic has been locked.
  • lintu
  • lintu's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 9 months ago - 6 years 9 months ago #155800 by lintu
Ben_V,

Thanks for your response.

I was able to create the user password by using SHA256 to hash the password and store it in the database table. I am now able to login as the new user and all the permissions that I set pragmatically through my plugin are working properly.


Closing this post.
Last edit: 6 years 9 months ago by lintu.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose