Use joomla user table with cakephp
i have working joomla project 开发者_Python百科(domain.kz).
and i need to build new independent project on subdomain (newapp.domain.kz)but i want to use joomla user table. (to let user auth with joomla logins)
- can i declare in user model the joomla jos_users fields
- is it possible to use 2 DB (old one for auth, the new one for new app)
Create a new database config in app/config/database.php
, then create your model as normal:
var $joomla_connection = array('driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'password!',
'database' => 'joomla_db',
'prefix' => 'jos_'); // I think this is correct
class User extends AppModel {
var $name = 'User';
var $useDbConfig = 'joomla_connection';
//your code here
//....
}
you will might experience problems with Auth when you login with the "security_salt" and "cipher" from cake against the user login data, that are created through joomla.
if Joomla saves md5 encrypted passwords you can modify cakestandard encryption with this: change hash function - cake cookbook
精彩评论