I get this message when enabling or disabling the module with Drush (the same message also appears when I log in to site after enabling module):

Warning: Missing argument 2 for dul_user_load() in dul_user_load() (line 41 of [...]/sites/all/modules/dul/dul.module).

Furthermore, the language selection form in user profile is still visible.

Comments

Anonymous’s picture

Title: Warning: Missing argument 2 for dul_user_load() i dul_user_load() (linje 41 af /home2/consejot/public_html/lkr/abv/sites/all/mod » Missing argument 2 for dul_user_load()
Anonymous’s picture

Status: Active » Fixed

I changed the code. hook_user_load() is not anymore used; the code instead uses hook_init().

Status: Fixed » Closed (fixed)

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

mesr01’s picture

@kiam: Could you please provide a patch? Thanks in advance.

timofey’s picture

Status: Closed (fixed) » Needs review

Needs to be verified & committed.

mesr01’s picture

@kiam: The dev still triggers the error. Could you please provide a patch? Thanks in advance.

mesr01’s picture

In file dul.module, replace line 13 by

if (isset($form['locale']) && isset($form['#user']) && !user_access('change own user language', $form['#user'])) {

and replace lines 41–45 by

function dul_user_load(&$accounts) {
  foreach ($accounts as $id => $account) {
    if (!user_access('change own user language', $account)) {
      $account->language = language_default('language');
    }
  }
}
henrijs.seso’s picture

StatusFileSize
new1.08 KB

In patch format.

bennetteson’s picture

Anonymous’s picture

Issue tags: -1.1 blocker

Actually, hook_user_load() cannot be used to alter values taken from the users table.

Due to the static cache in user_load_multiple() you should not use this hook to modify the user properties returned by the {users} table itself since this may result in unreliable results when loading from cache.

What the development snapshot does is using hook_init().

/**
 * Implements hook_init().
 */
function dul_init() {
  if (!user_access('change own user language')) {
    global $user;
    
    $user->language = language_default('language');
  }
}

The alternative would be using a custom property that is loaded in hook_user_load().

I am changing the referred version, since bugs are fixed in the development snapshot.

Anonymous’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Issue tags: +1.1 blocker

I am adding issue tags to this report.