I had a problem with the links in the facebook canvas pages redirecting back to the website when using pathauto. I solved this by adding $options['alias'] = $path; at the end of the fb_url_outbound_alter, bypassing the normal path's alias.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

blup’s picture

FileSize
773 bytes

I also had to add another condition to the function in case the fb_url_alter option is not set, otherwise it'll rewrite all aliases. I've attached a patch.

Dave Cohen’s picture

Status: Needs review » Needs work

There may be a bug that needs fixing, but that fix is not it. You're just stopping it from doing what it is trying to do.

I haven't reproduced this myself and at this point can't offer something more helpful. But just looking at that patch I can tell that's not the right thing.

blup’s picture

Well, when you look at the url() function, if there are existing (pathauto) aliases they will take precedence over rewritten links. Thus I believe you should define your path as an alias.

Line #2142 of common.inc :

elseif (!empty($path) && !$options['alias']) {
  $language = isset($options['language']) && isset($options['language']->language) ? $options['language']->language : '';
  $alias = drupal_get_path_alias($original_path, $language);
  if ($alias != $original_path) {
    $path = $alias;
  }
}
Steven Jones’s picture

Right, this is because FB module is working around a bug in Drupal core, so it can work with multilingual sites, but the bug nasty, and should just fixed in the core, because the workaround doesn't work for paths with an alias. Attached is a patch that reverts to the correct way of doing things in the FB module, and I'll file a patch for Drupal core.

Note that PURL has the same issue here: #1256272: No URL rewriting in Purl for D7

Steven Jones’s picture

I've raised the bug in Drupal core: #1270894: Test that it is possible to use path prefixes in combination with language prefixes
And have a sandbox project which implements a workaround for those that don't want to patch core: http://drupal.org/sandbox/darthsteven/1270906

Both largely untested.

Dave Cohen’s picture

Are you saying I should apply #4, and it will work whether core gets patched or not?

Or, do I have to wait for the core patch before applying this?

So frigging confusing...

Steven Jones’s picture

Nah, if you apply patch 4, and are using language specific URL re-writing from core, then it won't work.

But, you can either apply the patch, or use the workaround in the sandbox to get it working again.

Steven Jones’s picture

Actually the previous patch generates a notice. Correction attached, note that these no longer apply to HEAD, but do apply to: c592885cb7d1c46fb005afd34d35211d410c4b1a.

aliyayasir’s picture

Status: Needs work » Active

what about D6 patch?

dariogcode’s picture

I'm using the last 7 dev version and path aliases aren't working, all path inside canvas page show original path, not aliases. Do you have any ideas what I need to patch and where?

Dave Cohen’s picture

This is an old thread, and if I understand Steven Jones' comments correctly, it can't be fixed in modules/fb alone and requires a change to core. Is that right?