Iam using cakephp 2.2.1 and trying to use the cakedc users plugin, when I try to create a user I get the following error, can anyone give some tips or advice to resolve this error - I have loaded all tables using the migrations plugin. Thanks in advance :).
2013-04-07 06:31:33 Error: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'register' at line 1
#0 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(459): PDOStatement->execute(Array)
#1 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(425): DboSource->_execute('register', Array)
#2 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(669): DboSource->execute('register', Array, Array)
#3 C:\wamp\www\toppin\lib\Cake\Model\Datasource\DboSource.php(611): DboSource->fetchAll('register', Array, Array)
#4 C:\wamp\www\toppin\lib\Cake\Model\Model.php(788): DboSource->query('register', Array, Object(User))
#5 C:\wamp\www\toppin\app\Plugin\Users\Controller\UsersController.php(331): Model->__call('register', Array)
#6 C:\wamp\www\toppin\app\Plugin\Users\Controller\UsersController.php(331): User->register(Array)
#7 [internal function]: UsersController->add()
#8 C:\wamp\www\toppin\lib\Cake\Controller\Controller.php(485): ReflectionMethod->invokeArgs(Object(UsersController), Array)
#9 C:\wamp\www\toppin\lib\Cake\Routing\Dispatcher.php(186): Controller->invokeAction(Object(CakeRequest))
#10 C:\wamp\www\toppin\lib\Cake\Routing\Dispatcher.php(161): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#11 C:\wamp\www\toppin\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#12 {main}
Add function:
public function add() {
if ($this->Auth->user()) {
$this->Session->setFlash(__d('users', 'You are already registered and logged in!'));
$this->redirect('/');
}
if (!empty($this->request->data)) {
$user = $this->User->register($this->request->data);
if ($user !== false) {
$this->_sendVerificationEmail($this->User->data);
$this->Session->setFlash(__d('users', 'Your account has been created. You should receive an e-mail shortly to authenticate your account. Once validated you will be able to login.'));
$this->redirect(array('action' => 'login'));
} else {
unset($this->request->data[$this->modelClass]['password']);
unset($this->request->data[$this->modelClass]['temppassword']);
$this->Session->setFlash(__d('users', 'Your account could not be created. Please, try again.'), 'default', array('class' => 'message warning'));
}
}
}