Including PHPBB functions directly into CakePHP

Sarina sent in a message with a much easier way to use phpBB functions in CakePHP when integrating the users.  Apparently, I invent my own complexity sometimes.  This is a far better way to code the User model than my sloppy copy/paste method outlined earlier.  Here's her code:

Note that you can shorten the model by including the functions directly from phpbb:

<?php
class User extends AppModel {
       var $name = 'Users';
       var $useTable = 'phpbb_users';
       var $primaryKey = 'user_id';
       var $displayField = 'username';
       
       function hashPasswords($data){
               if (isset($data['User']['user_password'])){
                       define('IN_PHPBB',true);
                       require_once('pth_to_phpBB3/includes/functions.php');
                       $phpbb_pw = $this->field('user_password', array('username' => $data['User']['username']));
                       if (phpbb_check_hash($data['User']['user_password'], $phpbb_pw)){
                               $data['User']['user_password'] = $phpbb_pw;
                       }
                       return $data;
               }
               return $data;
       }
}
?>

freetags:

Add new comment