a couple of us have been trying to use this module to rewrite paths for talk module. http://drupal.org/node/375272#comment-2848452

one has got it to work, one has not (me).

issue does not appear to relate to talk module per se, but that url alter is not working right somehow.

i say this because if i test url_alter module in combination with subpath alias module to simply rewrite admin paths, i get the same condition: outbound paths are rewritten (e.g., edit tab says "/pagepath/edit" instead of "/node/xxx/edit"), but when clicked, that path goes to page not found.

this is so with any such tabbed or link.

the same result happens when tried with talk module using code shown at comment link above. that code works for a1tsal, but not me.

i have cleared cache. have no caching enabled. have no url rewriting going on in settings.php. machine has been restarted, browsers closed, etc. no effect.

any ideas what could be wrong?

thank you.

Comments

Anonymous’s picture

When I first installed URL Alter, I tried the examples in the .api.php file ("Change all requests to 'e' to the user's profile edit page" and "Change all links for 'node/x' to 'article/x'"). Outbound URLs were re-written, but incoming ones were not recognized. This is pretty clearly not a Talk module problem.

Eventually after poking at it for a couple of hours, it started working, but unfortunately I can't reconstruct what I did to fix it.

Dave Reid’s picture

Status: Active » Fixed

The inbound examples were messed up: #644794: &$path should be &$result in url_inbound_alter documentation?. Please let me know if you have any other problems or questions.

john.kenney’s picture

ok, thank you.

bit cryptic for me to understand.

a1tsal: can you please take a look at this and modify your php snippets accordingly? i tried a few things, but it didn't change the result. i was probably doing it wrong.

also can you explicitly tell me which box i should be making the change to /comments in? i assumed the bottom box, but i realize i have no idea which is the 'inbound' url and which is the 'outbound', so i may have done it backwards. better yet, if you could reproduce the code with the change explicitly made, i'd be most grateful.

flevour is back from his trip in the next day or so. hopefully he will be able to follow up then if we still haven't got it working.

thank you.

Dave Reid’s picture

Status: Fixed » Postponed (maintainer needs more info)

Ack, sorry I only responded to #2. It would probably help seeing the actual code used.

john.kenney’s picture

ok, sure, dave. if you can look at it, that would be awesome. a1tsal and i are working on the same thing stemming from talk module paths problem, but he wrote the code. all i did was plug it in. as he reported on the other thread, he had trouble making it work, but then eventually it did.

code is shown on this comment and repeated below: http://drupal.org/node/375272#comment-2848452

the goal is to rename talk module paths from things like /node/151/talk to SEF paths like /pingo-review/comments.

per comment by greggles (http://drupal.org/node/375272#comment-2778394), he advised with use url_alter + subpath alias to make this happen.

a1tsal couldn't make it work with subpath alias, but finally did with this module alone. i can't make it work either way.

this code below doesn't do the /comments renaming part and i'm not sure where that is supposed to go.

in top box:

if (preg_match('|(.+)/talk$|', $path, $matches)) {
  $src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC",
    $matches[1],
    $path_language ? $path_language : $GLOBALS['language']->language));
  if ($src) {
    $result = $src . "/talk";
  }
}

in bottom box:

if (preg_match('|node/(\d+)/talk|', $original_path, $matches)) {
  $dst = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = 'node/%s' AND language IN('%s', '') ORDER BY language DESC",
    $matches[1],
    $path_language ? $path_language : $GLOBALS['language']->language));
  if ($dst) {
    $path = $dst . "/talk";
  }
}

any help would be much appreciated!

thank you very much.

Anonymous’s picture

#3: I had to take into account the documentation errors when I wrote the code; the snippets here are correct. I'll reply to the other part in the thread on Talk #751334: Option to use string different from "talk" in path.

#4: When URL Alter was not working for me, I duplicated the very simple "e" example in the documentation, and it didn't work. So the specific code is apparently not at issue. There must be some configuration problem. Apparently it doesn't involve Talk, because John saw failure with an install that didn't include the Talk module. Unfortunately I can't remember what I did to fix the problem in my install, so this thread is likely to be a dead end unless flevour runs into the problem and finds a fix.

Anonymous’s picture

I doubt this is relevant, but for the record:

PHP built On: Linux 2.6.18-028stab059.6 #1 SMP Fri Nov 14 14:01:22 MSK 2008 i686
MySQL Version: 5.0.90-community
PHP Version: 5.2.13
Web Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7a mod_bwlimited/1.4 PHP/5.2.13

abaddon’s picture

Status: Postponed (maintainer needs more info) » Active

i found i had to create a hook_boot for this to work on my module, and clear cache/visit the modules page after
maybe the hook functions arent defined when url_alter searches for them unless hook_boot is defined and my module is also loaded up at that time? i tried to die() on the beginning of the hooks, clear caches etc.. it didnt work unless i had hook_boot
my hook_boot is empty, i just define it