Closed (fixed)
Project:
URL alter
Version:
6.x-1.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Sep 2009 at 17:09 UTC
Updated:
15 Nov 2009 at 22:20 UTC
I'm trying to map some Wordpress paths to Drupal paths. I have a database table which has the corresponding paths and I have the following in a module, but I am getting Page Not Found. Am I using the module in the wrong way?
/**
*Implementation of hook_boot()
*/
function hook_boot() {
// Ensure this module is loaded for url_rewrite_inbound
drupal_load('module', 'mymodule');
}
/**
* Implementation of hook_url_alter_inbound()
*/
function mymodule_url_alter_inbound(&$result, $path, $path_language) {
// Map old wordpress aliases to Drupal internal paths
$query= db_query("SELECT src, dst FROM {mymodule_url_alias}");
while ($row = db_fetch_object($query)) {
if ($path == $row->dst) {
$result = $row->src;
}
}
}
Comments
Comment #1
dave reidFirst, make sure the first function is mymodule_boot(). And it can just be empty, you don't need to run drupal_load().
Second, I'd probably do something like this with the url_inbound_alter (note the change of name) function: