O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — cleaning up the signup process

Let's clean up our signup code by creating a public function, called signup, inside the User class.

  1. Open classes/user.php, and create a public function for signup.
    public function signup($username,$password) {
    }
    
  2. Enter the code to match the code below. It's almost identical to the code that we entered in the last section, except that instead of referencing $user, we are referencing $this. You'll also notice that full_name and email aren't located in this function; you'll see them in just a second.
    public function signup($username, $password) {
    $bones = new Bones(); $bones->couch->setDatabase('_users'); $bones->couch->login(ADMIN_USER, ADMIN_PASSWORD); $this->roles = array(); $this->name = preg_replace('/[^a-z0-9-]/', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required