Book Image

Twilio Cookbook: Second Edition

By : Roger Stringer
Book Image

Twilio Cookbook: Second Edition

By: Roger Stringer

Overview of this book

Table of Contents (20 chapters)
Twilio Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Deleting a subaccount


Ok, your user has chosen to delete his account. That's fine; let's handle how to make that work.

Getting ready

The complete source code for this recipe can be found in the Chapter9/Recipe7 folder in the source code for this book.

How to do it...

Our final recipe will walk you through how to delete a user's account. This will be done by updating the index.php file—for the last time—to the following content:

<?php
session_start();
include 'Services/Twilio.php';
require("system/jolt.php");
require("system/pdo.class.php");
require("system/functions.php");

$_GET['route'] = isset($_GET['route']) ? '/'.$_GET['route'] : '/';
$app = new Jolt('site',false);
$app->option('source', 'config.ini');
#$pdo = Db::singleton();
$mysiteURL = $app->option('site.url');

$app->condition('signed_in', function () use ($app) {
        $app->redirect( $app->getBaseUri().'/login',!$app->store('user'));
});

$app->get('/login', function() use ($app){
        $app->render...