Using the latest version of the module for D7, and it simply is not working. In fact, it broke the login for my slave site.

I have two Drupal installations in separate directories which share the same top-level domain, and I have checked again and again to make sure I followed the installation instructions exactly. I am able to log into the master site, but when I navigate to the slave site from there, I am asked to log in separately.

Interestingly, when I try to log in at the slave site, I receive the following error:

Fatal error: Call to undefined function drupal_execute() in /srv/www/my-site.com/public_html/master-site/sites/all/modules/bakery/bakery.module on line 692

What could be the issue here? I know this module works as advertised for many people, but I carefully followed the installation instructions on my server and yet it is completely broken for me. Any help is very much appreciated.

Comments

rbenhase’s picture

Component: Documentation » Code

I did a little digging and saw that drupal_execute() is obsolete in Drupal 7, though it's there in the D7 version of bakery.module. I tried changing it to drupal_form_submit() and the error message went away (may want to commit this?), but the module is still not working. Once again, when I log in at the master and navigate to the slave, I am prompted to log in separately (which fails). In fact, simply navigating to the slave site after logging into the master actually appears to log me out of the master site as well.

A look at the users table in the database shows that a new user account was not created on the slave during this process.

Does anyone have any ideas?

abx’s picture

Have you hit Enter when put in the slave site? (Step 5) I got similar problem to you and I was pretty sure I did everything correctly. Still, I couldn't log in into Slave site until I tried to hit Enter at the end of the slave site to get another line :

http://slave.testsite.com/ 

[Hit Enter to get another line. Then save.]
coltrane’s picture

Title: Module simply isn't working. » Call to undefined function drupal_execute

You are right :) http://drupal.org/update/modules/6/7#drupal_execute_drupal_form_submit

I'm not sure D7 had been tested enough as a master, doing so now …

coltrane’s picture

Status: Active » Needs review
StatusFileSize
new2.23 KB

Replaced the function. Also kept in core user login validation functions because in D7 they don't log the user in.

greggles’s picture

Looks sane to me.

killtheliterate’s picture

Patched with #4 - Logging in to master site, and then navigating to child site responds with the below error

Notice: unserialize() [function.unserialize]: Error at offset 0 of 112 bytes in bakery_request_account() (line 1211 of /home/honeytr/public_html/d7_multisite/sites/all/modules/bakery/bakery.module).

Déja’s picture

It's pretty clear that there has been zero testing of Bakery 7.x-2.x running as a master server. In addition to the changes needed in patch #4, there are a couple other issues:

1. _bakery_save_slave_uid was not updated to use DBTNG.
This is actually the cause of the unserialize error reported in comment #6. _bakery_save_slave_uid was throwing an error because db_result doesn't exist in Drupal 7.
2. There appears to be a bug that causes forms submitted via drupal_form_submit() to only run the first validator.
In case you aren't aware, Drupal 7 uses 3 validators on the user_login form. The second validator is the one that actually checks the user/pass against the database and returns the uid. If that validator isn't run, a large pile of errors erupt because the form_state is considered as having been validated and is given to user_login_submit, but it's missing the data that user_login_submit function expects to have been inserted by the validators.
This is probably the result of a bug in the bakery_form_alter hook

I'm sure there are other issues, but these are the ones that I've managed to track down thus far, and by applying them I now have a working Drupal 7 Master and Drupal 7 slaves.

Note that the attached patch includes the changes in patch #4 above

coltrane’s picture

Thanks.

Updated patch. Removed tab characters and direct calls to user login validation functions. In Drupal 6 those functions regenerate the session so they were removed with a form alter. We can use them in Drupal 7.

Starminder’s picture

Thanks - will this get rolled into a dev release?

greggles’s picture

The best thing to move it forward is a patch review.

ekristen’s picture

The patch on #8 makes 7x-2.x-dev workable. Please get it into review process and get it up for approval.

coltrane’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.