Hello all,

What is the best method for creating a pointer between a user and its corresponding QR code? Concretely I want to be able to scan a QR code, be redirected to a page on a specific website which I am devloping, have to enter some information and that information goes in the form of an email to the (registered) person whose unique identifier was embedded in the QR code. Something like www.mysite.com/process_incoming_scanned_QR_code/123456789123, where 123456789123 is the user’s unique identifier, to which an email should be sent, automatically generated by the application.
Any ideas on what text I should QR code (my proposal is www.mysite.com/process_incoming_scanned_QR_code/123456789123)? And which modules are needed to do the above?

Thanks for your help.

Pierre

Comments

nevets’s picture

What are you generating the QR code from? My initial thoughts would be to generate it from the user id (uid) or user name both of which are unique.

Another choice is to place the form at a url like www.example.com/user/{uid}/{page_name} where {uid} is a user id and {page_name} is what ever you want to call the page/tab. In this case the QR code be the URL.

Pierre2020’s picture

Yes, I imagined the QR code having two pieces of information (possibly compacted with a TinyURL like application): the website where the User ID information will be processed, and the UI itself.
The key thing is that the person who scans that QR code is most likely not registered on the web site, and even if he/she is, should not see any user specific information, the one that corresponds to the UI being scanned.
That person should land on a page (on that web site), and the application should extract from the URL the ID, bring up a webform, and let that person enter some information (name, phone number etc). Press send and an email goes to the person holding that unique ID without disclosing its name, email address etc.
In that application, I have a number of questions. Like:
1) How to extract the ID from the URL sent?
2) And then, having extracted it, find the corresponding email address to be used in hidden mode to send the information provided through a web from.

jaypan’s picture

Basically you'll have to create a dynamic callback path on your Drupal site, and then have the QR code point at that URL. Then when users access that URL (using the QR code), you can trigger the email, then either redirect the user to some other page, or show them whatever info you want on that page.

That's the theory of how it would be done, I don't know how you'd do it with contributed modules though. It may require custom development.

Contact me to contract me for D7 -> D10/11 migrations.

Pierre2020’s picture

May be someone in the community may help here. If indeed no contributed modules exist, what would be the path to the solution? Some PHP code to extract the UI from the incoming URL? I will dig into it, but some directions would be most useful, as I have very little experience...

jaypan’s picture

It's a little more than can be explained in a forum post. You'll need to:

1) use hook_menu() to create a callback path that the QR code will refer to
2) Set a dynamic component to that path to accept either a UID (User ID) or a value that will refer to a User's ID.
3) Create a callback function that will take the UID that has been submitted in the dynamic path element, use that to load the user object, then use a combination of hook_mail() and drupal_mail() to send a mail to the user being referenced.
4) Either use drupal_goto() to redirect the user, or return some HTML to the browser to be shown to the user accessing the page.

Contact me to contract me for D7 -> D10/11 migrations.

Pierre2020’s picture

... definitely dense as a forum post. I thank you for showing a possible direction. I'll dig into it.