I have two modules installed that send emails with hook_cron (private messages, when set do daily reminder AND account reminder)

I suspect i18n's custon_url_rewrite function for the following problem: The base url does not appear in links. Example:

You may also log in by clicking on this link or copying and pasting it in your browser:

http:///en/user/reset/94/1211673601/5efb9THIS-LINK-IS-USELESS7ba

Comments

derjochenmeyer’s picture

Title: problem with custom_url_rewrite » problem with i18n_get_normal_path
Priority: Normal » Critical

The problem above is present with all modules that send emails via cron (update_status, account_reminder, organic_groups, privatemsg, ...)

I modified the function which seems to solve the problem. I have not much experience with the url modification functions in drupal. Is there someone who can tell me if what i did makes any sense? I added the following code:

    if (function_exists('drupal_lookup_path')) {
      $path = drupal_lookup_path('source', $path);
    }

The whole function looks like this:

/**
 * This function is similar to drupal_get_normal_path, but language-aware
 * Also removes language from path
 */
function i18n_get_normal_path($path) {
  $prefix = i18n_get_lang_prefix($path, TRUE);
  if(!$prefix || _i18n_is_bootstrap()){
    // If bootstrap, drupal_lookup_path is not defined
    // Why not check if function exists?
    if (function_exists('drupal_lookup_path')) {
      $path = drupal_lookup_path('source', $path);
    }
    return $path; 
  } // First, check alias with lang
  elseif($alias = drupal_lookup_path('source', $prefix.'/'.$path)){
    i18n_get_lang_prefix($alias, TRUE); // In case alias has language
    return $alias;
  } // Check alias without lang
  elseif($alias = drupal_lookup_path('source', $path)){
    i18n_get_lang_prefix($alias, TRUE);
    return $alias;
  } 
  else {
    return $path;
  }
}
derjochenmeyer’s picture

ups... that modification killed my site ;-) anybody with a better idea? The modification fixed the email messages but killed everything else including imagecache...

derjochenmeyer’s picture

still no clue what could be done here... it just seems that function is getting the wrong urls when run by cron... any ideas?

-Anti-’s picture

Version: 5.x-2.3 » 6.x-1.x-dev

> The problem above is present with all modules that send emails via cron
> (update_status, account_reminder, organic_groups, privatemsg, ...)

I have this problem. It is still present in i18n 6.x-1.x-dev (if indeed i18n is the cause).
I'm using D6.9.
I have drupal installed in a subdomain.

This issue seems like it was never solved?

jose reyero’s picture

Version: 6.x-1.x-dev » 5.x-2.3

@Anti,

This url rewrite functions are not anymore in D6 i18n so for D6 this is either not i18n or an unrelated issue.

-Anti-’s picture

Thanks jose.

Just for clarification, are you saying that it isn't possible for the D6 i18n to cause these symptoms *at all*?
Or are you saying, it *is* possible, but that the custom_url_rewrite as described above isn't the cause?

Cheers.

jose reyero’s picture

I'm saying D6 doesn't even have custom_url_rewrite, nor i18n does any path rewriting at all.

So while for D5 all these troubles are likely to be caused by i18n, for D6 you better search in Drupal core or other module (og?).

-Anti-’s picture

ok... thanks.

R.Hendel’s picture

Status: Active » Closed (won't fix)

Deprecated - D5 is no longer supported.