Info
- OS: both linux and windows
- Web Server: Apache 2.2.17
- PHP 5.2.17
- Drupal 6.22
- Domain 6.x-2.13 (and previous version, since upgrade to this version did not solve the issue)

My site contains a language navigation, which is built using the l() function.
Without the 'domain_prefix' module enabled, the urls of that navigation are as expected:
- /nl/my-alias-nl
- /fr/my-alias-fr
- ...
But if I enable the 'domain_prefix' module on the 'url_alias' table, I get the following url's
- /nl/node/XX
- /fr/node/YY
- ...

Walking through the code delivers the following stack trace:
- l() (in 'common.inc')
- url() (in 'common.inc')
- domain_url_outbound_alter (in 'settings_custom_url.inc')
- domain_path (in 'domain.module')
- domain_prefix_domainpath (in 'domain_prefix.path.inc')

The problem appears in the following snippet of the 'domain_url_outbound_alter' function:

if ($path_rewrite > 0 && $path != '') {
    $path = domain_path($target_domain_id, $original_path, isset($options['language']) ? $options['language']->language : '');
}

Before this code is called, the $path variable contains the correct path (ex. '/nl/my-alias-nl'), but after this snippet its no longer correct (ex. '/nl/node/XX').
That's because the '$original_path' is passed to the 'domain_path' function (with for example the value '/nl/node/XX'), and the function 'domain_prefix_domainpath' does nothing with it because of the following code:

  if ($domain_id == $_domain['domain_id']) {
    $path = drupal_get_path_alias($path);
    return;
  }

This results in the correctly aliased '$path' being overwritten with the node url in '$original_path', which is definitely not what I want.

I'm not sure what would be the best place to fix this, so I have not yet written a patch.

Thank you for any ideas on this issue.

Comments

lufecir’s picture

StatusFileSize
new583 bytes

When reading my post to check if everything is clear, I notice I have missed something.

The function 'domain_prefix_domainpath' does do something with the $path, since this variable is passed by reference to this function.

The problem is in the fact that the language is not passed to the 'drupal_get_path_alias' function.

So this seems to be the correct call:

  if ($domain_id == $_domain['domain_id']) {
    $path = drupal_get_path_alias($path, $path_language); // <-- Added $path_language
    return;
  }

Patch included.

agentrickard’s picture

Status: Active » Needs review

This module is seeking a new maintainer.

agentrickard’s picture

Here's a version against d6 that would go into the Domain module proper.

agentrickard’s picture

The d6 version has been committed.