UserPhone for ExpressionEngine 2.x

<p>This module allows you to request site members to enter their phones and validate them via SMS (by asking users to enter the code they've received in SMS). When phone is verified, the user can be moved to another group.</p>

<p>To send verification SMS, you will need to use third-party SMS gateway service. Currently following are supported: <a href="http://www.twilio.com/">Twilio</a>, <a href="http://www.clickatell.com/">Clickatell</a><!--, <a href="http://www.textmagic.com/">TextMagic</a>--> and <a href="http://www.smsglobal.com/">SMS Global</a>.</p>

<h3>SMS Template</h3>

<p>SMS template is defined in module settings. Make sure to include <strong>{code}</strong> variable that will contain verification code.</p>

<h2>Display user phone</h2>

<p><strong>{exp:userphone:phone}</strong></p>

<code>{exp:userphone:phone member_id="CURRENT_USER"}</code>

<code>{exp:userphone:phone username="{segment_2}"}</code>

<p><strong>Parameters</strong> (all optional): 
  • member_id — if of member to get verified phone number. Use member_id="CURRENT_USER" to display logged in user's phone.
  • username — alternatively, user member's username

<h2>Adding phone number</h2>

<p>To let user's add or modify phone number, you'll need to use 'add' tag.</p>
<p><strong>{exp:userdata:add}</strong></p>
{exp:userphone:add return="/user/verify-phone"}
<p>Please provide your phone number. You will receive SMS with verification code.</p>
<p><input name="phone" value="{phone}" /></p>
<p><input type="submit" value="Add phone" /></p>
{/exp:userphone:add}

Tag parameters:

  • return — a page to return to after submitting the form. Can be a full URL or URI segments.
    Use return="SAME_PAGE" to return user to the page used to display this form.
  • skip_success_message="yes" — force redirect to return page without showing success message.
  • ajax="yes" — turn on AJAX mode. The success or error messages shown upon submission will be shown as simple text, without using message templates. The "return" parameter will not be functional if you supply this parameter.
  • id — form ID (defaults to 'userphone_form')
  • class — form class (defaults to 'userphone_form')
  • name — form name (defaults to 'userphone_form')

Form fields:

  • phone — input for phone number

Variables:

  • {phone} — existing phone number recorded for user

<h2>Phone verification</h2>

<p>When the phone is added, the user received SMS with verification code. To get phone number verified, he has to enter in to the form created using  'verify' tag.</p>
<p><strong>{exp:userphone:verify}</strong></p>
{exp:userphone:verify return="/user"}
<p>
Please enter the code you have received in SMS.
<a href="{request_new_code}">Request new code</a>
</p>
<p><input name="code" value="" /></p>
<p><input type="submit" value="Verify phone" /></p>
{/exp:userphone:verify}

Tag parameters:

  • return — a page to return to after submitting the form. Can be a full URL or URI segments.
    Use return="SAME_PAGE" to return user to the page used to display this form.
  • skip_success_message="yes" — force redirect to return page without showing success message.
  • ajax="yes" — turn on AJAX mode. The success or error messages shown upon submission will be shown as simple text, without using message templates. The "return" parameter will not be functional if you supply this parameter.
  • id — form ID (defaults to 'userphone_form')
  • class — form class (defaults to 'userphone_form')
  • name — form name (defaults to 'userphone_form')

Form fields:

  • code — input for verification code from SMS

Variables:

  • {request_new_code} — link to request new code in new SMS
  • {phone} — pending phone number that awaits verification