2

Is there a way to register on my Drupal site with mobile number and password instead of email?

I would like to have my users register on my Drupal site with either mobile number and password or email and password. The confirmation code is sent to the corresponding destination and the user is activated.

2
  • How do you send SMS messages to your users?
    – Mołot
    Dec 5 '14 at 13:57
  • I have a SMS gateway API. I am planning to use wsclient module for sending SMS.
    – GeekTantra
    Dec 5 '14 at 14:01
5

Yes, it is possible, but you will have a lot of work to do it.

First thing first, you need a way to communicate with your users. Drupal sends quite a lot of data to users, like password restoration mails. If you want phone numbers to replace mail, you need to be able to send SMS messages. SMS Framework seems to be your friend here. There is no stable version for Drupal 7, but as far as I know it is most stable at the moment anyway.

When you have a way to communicate using their mobile numbers, you need to override mail sending, to convert mails into SMS messages. There are, generally, two ways to achieve this:

  1. SMTP Authentication Support - It is possible to configure mailserver to send sms messages if address is in phone_number@sms.local or similar format. This does not even require any SMS framework in Drupal, really.

  2. Use Mail System and create your own MailSystemInterface implementation that will detect sms addresses and use SMS Framework instead of whatever mail system you are using.

If you don't want to mess with mail systems, you will need to effectively write user module from scratch and replace core one with your own - it relies on mails too much, writing alters would not be feasible.

Last thing: For all Drupal forms, you need to use form alter and detect required email, changing it into two fields, at least one required. And provide relevant storage. Actually, this seems to be an easy part.

Note pretty much every modern phone can receive emails, so I hardly see a point in this.

3
  • Interesting. I wonder whether there is a way for Drupal to "read" the visitor's phone number and paste it into the appropriate field automatically.
    – iantresman
    Dec 5 '14 at 15:48
  • 2
    @iantresman Wrong question - you should be asking 'is there a way for a website to "read" the visitor's phone number'. Drupal is essentially a glorified HTML generator, it can't do anything that HTML/CSS/JS can't do. Either way I think you'll find the answer is "no". The privacy quarter would have gone mental about it by now if an arbitrary web page was able to scrape a user's phone number without their explicit permission
    – Clive
    Dec 5 '14 at 16:48
  • @Clive Do you know of any email to sms gateway for D7? There is one, but it does not even have a dev release. drupal.org/project/sms_email_gateway
    – Umair
    Sep 11 '19 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.