Joomla/Drupal instructions

Questions related to installing Zuluru 1: Locked now, all new installations should use Zuluru 3
Locked
spikerzulu2
Posts: 2
Joined: Tue Jul 29, 2014 12:57 am

Joomla/Drupal instructions

Post by spikerzulu2 »

Hi!

I'm trying to build a basic site around a Zuluru installation, with "About" and similar pages to be updated by other admins. It seems the easiest way to accomplish this is integrating Zuluru with Joomla or Drupal. Are there instructions on how to do this, or a good place to start? I have both installed but I don't know where to go from here.

Thanks!

dyoung
Posts: 68
Joined: Mon Dec 09, 2013 5:33 pm

Re: Joomla/Drupal instructions

Post by dyoung »

Below is an email Chain I had with Greg earlier this year. You can use it as a starting point.

Can you explain, "... running Zuluru with a third-party user database" and how to go about setting that up. If it is not too extensive and you have time to explain.

DYoung


Greg Schmidt Jan 13

Zuluru includes user models that allow it to work with Joomla, Drupal or Zikula user databases. If your main site is running on one of those systems, then you can set this up (primarily by changing the security.auth_model setting in config/install.php), and this will let the two systems share a user database, and perhaps more importantly, give you single sign-on capability so you can switch between the two without needing to re-authenticate. I also have a partial solution for WordPress, but this is unreleased, as it's incomplete, and people running WordPress seem to only have one or two accounts on that site for system administration, as opposed to Joomla and Drupal sites where every member is encouraged to have their own account to access forums, etc. The todo list includes adding such a model for phpBB3 and perhaps other such systems.

There are also CMS-specific modules that can further enhance this integration, by essentially placing Zuluru "inside" the CMS template, but so far these are complicated to set up, and have only been offered to clients hosted with Zuluru.net; the expected level of support to get these set up and keep them running on an unknown system is more than I'm able to provide for free.

Greg.


DYoung Jan 13

Ok, so reading your comments in (for example) models/user_drupal.php, I put the 'drupal_root' and 'auth_session' lines in the config/install.php file where stated. Would that change then automatically allow the sharing of the user database or do I have to go to zuluru/install/install?


Greg Schmidt Jan 13

If you've changed the auth_model from User to UserDrupal and added the two new lines, that should be all you need for it to start using the Drupal database instead of the Zuluru one for user authentication. Note that the value of auth_session in particular can be a bit tricky to work out, in my limited experience.


DYoung Feb 3

I know you have said you have limited experience with this, but I have tried many things in the auth_session and constantly get the same results:

Fatal Error (256): ConnectionManager::getDataSource - Non-existent data source drupal [CORE/cake/libs/model/connection_manager.php, line 102]

Code | Context
$this->useDbConfig = $dataSource;
}
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$name = "drupal"
$_this = ConnectionManager
ConnectionManager::$config = DATABASE_CONFIG object
ConnectionManager::$_dataSources = array
ConnectionManager::$_connectionsEnum = array
ConnectionManager::getDataSource() - CORE/cake/libs/model/connection_manager.php, line 102
Model::setDataSource() - CORE/cake/libs/model/model.php, line 2852
Model::__construct() - CORE/cake/libs/model/model.php, line 469
UserDrupal::__construct() - APP/models/user_drupal.php, line 63
ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 142
Person::__construct() - APP/models/person.php, line 322
ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 142
Controller::loadModel() - CORE/cake/libs/controller/controller.php, line 637
Controller::constructClasses() - CORE/cake/libs/controller/controller.php, line 502
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 186
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

I am a little confused with the "Non-existent data source drupal". If you have any insight that would be great, otherwise this is just an update to my previous message.

DYoung



Greg Schmidt Feb 3

Ah yes. You need to add the drupal data source (likely just an exact copy of the default data source, but with the name changed) in config/database.php. I'll document that requirement...


DYoung Feb 3

That helps. An exact copy? I pointed the 'database' to the drupal database and I did not get any errors. Working through things now. Thanks for the direction.

DYoung



Greg Schmidt Feb 3

to me
If Drupal is in a different database from Zuluru, then of course you need to change that. I usually find it easiest to put them in the same database, but that may just be me. Note that if the Drupal database has a table name prefix, that will come from the Drupal config itself; the prefix in the drupal data source in the config/database.php should be left blank.

DYoung Feb 3

I just tried putting them in the same database and ran into the problem with them both having a 'users' table.
If I try to install Drupal after Zuluru and point Drupal to the zuluru database, Drupal stops because there is already a 'users' table.
If I try to install Zuluru after Drupal and point Zuluru to the drupal database, Zuluru stops because there is already a 'users' table.

DYoung

Here is the Zuluru error:

Warning (512): SQL Error: 1050: Table 'users' already exists [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
Query: CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`session_cookie` varchar(50) DEFAULT NULL,
`last_login` datetime DEFAULT NULL,
`client_ip` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`),
UNIQUE KEY `user_name` (`user_name`)) DEFAULT CHARSET=utf8,
COLLATE=utf8_general_ci,
ENGINE=InnoDB;

Warning (512): SQL Error: 1054: Unknown column 'Users.id' in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
Query: SELECT COUNT(*) AS `count` FROM `users` AS `Users` WHERE `Users`.`id` = 1

Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line 1329]
Warning (512): SQL Error: 1062: Duplicate entry '0' for key 'PRIMARY' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]
Query: INSERT INTO `users` (`uid`, `access`, `login`, `status`, `picture`) VALUES (0, 0, 0, 0, 0)

Warning (2): Cannot modify header information - headers already sent by (output started at /usr/share/php/cake/libs/debugger.php:686) [CORE/cake/libs/controller/controller.php, line 742]


Greg Schmidt Feb 3

I don't know much about the Drupal install process or how to set the prefix there. I know it's in the config somewhere, and I think it's something that Drupal asks for during setup, but I obviously don't know how it deals with it internally.

As for Zuluru, it doesn't currently ask for the prefix during installation, but you can fudge it... Once you get past the page asking for database details, but before you start to populate it, the config/database.php file exists, and you can edit that manually to set the prefix for the "default" data source, to something like "z_". Then continue with the web install, and it should create the tables with your selected prefix.

Alternately, take your pre-existing stand-alone Zuluru database, rename the tables in it, dump it, and restore into the Drupal database.

Or, just leave them in separate databases; I believe that I've eliminated all of the bugs associated with that setup, or at least all of the serious ones, as I now have a large client running in that configuration.

Greg.

DYoung Feb 3

Continuing down the path with separate databases, (since that is what I currently have), it seems to be partially working.
When I go to http://localhost/drupal7 I can login as admin without a problem.
When I go to http://localhost/zuluru, I get the non-login view. (Limited Registration, League, Fields, Help and reset password.) When I go to http://localhost/zuluru/users/login and type the same login and password as drupal I get the "if you already have an account from a previous session, do not create another account....." So I then try the reset password option. I get the emails with the links to change the password and then I get the email with the new password.
When I go to http://localhost/zuluru/users/login and try admin, with the password from the email, it does not let me in.
When I go to http://localhost/drupal7 and login as admin I must use the password from the zuluru password change email.

So Zuluru seems to be changing the drupal admin user's password in the drupal database, but I can not see the admin level of the Zuluru page.

Thanks for all your help thus far. I will continue to search for answers and let you know what I find.

DYoung

DYoung Feb 3

Also you mentioned in your email about 1.7.3 that:
"...Zuluru "view player" page now shows a Zuluru user id and a CMS (e.g. Joomla) user id."

I only see a Zuluru user id, but no reference to any other user id. Should there be a field in the people table that refers to this CMS user id?

DYoung

Greg Schmidt Feb 3

I just realized that the one site using this in separate databases actually uses some different code for the login part, so it's possible that the standard login doesn't work right when they're in separate databases. I'll see about looking into this tomorrow and let you know what I learn.

The people table has a user_id field that should reference the Drupal user. If you had a pre-existing database of both users and people, that may not have been updated correctly, but the old code kept the two ID fields (Drupal user ID and Zuluru person ID) in sync, so user_id *should* have been set correctly in the update process.

Have you pulled all the latest bug fixes? The initial 1.7.3 release was, sadly, not a great moment in the annals of thorough testing.

Greg.

DYoung Feb 4

I have set up a new Drupal and Zuluru to mimic what I will do in production. I have downloaded the latest Zuluru Master.

Greg Schmidt Feb 4

Now that I think about this a little more, the login is actually behaving as I'd expect. That's maybe not how it should be expected to, but that's another question... Since you're using Drupal, you shouldn't actually have a link to http://localhost/zuluru/users/login anywhere. You log in through Drupal, and Zuluru should recognize that session. The question is why it's not. My guess is that the auth_session may not be set correctly in config/install.php. I'm not really sure how to get the correct value there other than trial and error of various combinations of your host name; some of the sites I have running correctly have values of the ".xyz.com" form (note the leading period), and others are more like "abc.xyz.com".

DYoung Feb 4

Right, I have been looking and have also come the to the conclusion that it is not reading the cookie. I will pursue the auth_session more.

thanks for the direction.
DYoung

DYoung Feb 4

GOT IT!
As my Drupal site accessed at http://localhost/drupal7
the auth_session is set to localhost/drupal7

Things are preliminarily looking good.

Thanks
DYoung

spikerzulu2
Posts: 2
Joined: Tue Jul 29, 2014 12:57 am

Re: Joomla/Drupal instructions

Post by spikerzulu2 »

dyoung,

Thank you! This is a great starting point. Also thank you (by proxy) Greg.

GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Joomla/Drupal instructions

Post by GregS »

dyoung wrote:Below is an email Chain I had with Greg earlier this year. You can use it as a starting point.
Thanks for pulling this together! I'll edit it down a bit to pull out the more salient pieces...

Zuluru includes user models that allow it to work with Joomla, Drupal or Zikula user databases. If your main site is running on one of those systems, then you can set this up, and this will let the two systems share a user database, and perhaps more importantly, give you single sign-on capability so you can switch between the two without needing to re-authenticate. I also have a partial solution for WordPress, but this is unreleased, as it's incomplete, and people running WordPress seem to only have one or two accounts on that site for system administration, as opposed to Joomla and Drupal sites where every member is encouraged to have their own account to access forums, etc. The todo list includes adding such a model for phpBB3 and perhaps other such systems.

To get one of the other user models working, you will need to:
  1. Change the security.auth_model setting in config/install.php.
  2. Possibly add new lines to config/install.php, as documented in the model file you will be using (e.g. models/user_drupal.php specifies that drupal_root and auth_session values must be added; models/user_joomla.php requires a jpath_base value).
    • I'm not really sure how to get the correct value for Drupal's auth_session other than trial and error of various combinations of your host name; some of the sites I have running correctly have values of the ".xyz.com" form (note the leading period), and others are more like "abc.xyz.com".
  3. Add a drupal or joomla data source in config/database.php.
    • If you are putting your CMS in a different database than Zuluru, the new data source will need the details of that database instead.
    • If you are putting your CMS in the same database as Zuluru, you can use an exact copy of the default data source, but with the name changed. However, the CMS and/or Zuluru will need to be installed with a table name prefix. Note that if the CMS database has a table name prefix, that will come from the CMS config itself; the prefix in the new data source in the config/database.php should be left blank.

      I don't know much about the Drupal install process or how to set the prefix there. I know it's in the config somewhere, and I think it's something that Drupal asks for during setup, but I obviously don't know how it deals with it internally. Ditto for Joomla.

      As for Zuluru, it doesn't currently ask for the prefix during installation, but you can fudge it... Once you get past the page asking for database details, but before you start to populate it, the config/database.php file exists, and you can edit that manually to set the prefix for the "default" data source, to something like "z_". Then continue with the web install, and it should create the tables with your selected prefix.
  4. Do not use http://localhost/zuluru/users/login. Log in through your CMS, and Zuluru will recognize that session.
There are also CMS-specific modules that can further enhance this integration, by essentially placing Zuluru "inside" the CMS template, but so far these are complicated to set up, and have only been offered to clients hosted with Zuluru.net; the expected level of support to get these set up and keep them running on an unknown system is more than I'm able to provide for free.

Greg.

Locked