Hi,
I successfully use this module for it's initial purpose, but I really need to keep my users synchronized on both master and slave environnements, even if the user hasn't logged in the slave site yet.

For this, I built a small module consisting in :

function mymodule_synchronize_user_update(&$edit, $account, $category) {
  if (variable_get('bakery_is_master', 0) && $account->is_new) {
    $slaves = variable_get('bakery_slaves', array());
    foreach ($slaves as $slave) {
      $options = array(
        'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'),
        'method' => 'POST',
        'data' => 'name=' . $account->name,
        'timeout' => 120,
      );
      $result = drupal_http_request($slave . 'synchronize/user', $options);
    }
  }
}

function mymodule_synchronize_menu() {
  $items['synchronize/user'] = array(
    'page callback' => '_mymodule_synchronize_pull_from_master',
    'access callback' => true,
  );
  return $items;
}

function _mymodule_synchronize_pull_from_master() {
  $name = $_POST['name'];
  watchdog('mymodule_synchronize', '<pre>' . var_export($_POST, true) .'</pre>');
  if (!empty($name)) {
    bakery_request_account($name);
  }
}

The user is created but if I log in the master site and change the user password, the change isn't replicated in the slave site. Does the way I created the user is linked with this problem ?

Comments

Nishruu’s picture

Issue summary: View changes
Nishruu’s picture

Issue summary: View changes