Jump to:
| Project: | OG Vocabulary |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hey,
I'm trying to get the new version of facebook working on my installation and I'm having some trouble. I have read the documentation and it said something about patching my common.inc file (which I have done using the diff file on the link provided on the readme.txt, marking the first time I've ever needed to patch my system to install a drupal module), but once I add the two statements to my settings.php file:
$conf['fb_api_file'] = 'api/facebook.php';
require_once "sites/all/modules/fb/fb_settings.inc";I get an error about a declaration of a function:
Fatal error: Cannot redeclare custom_url_rewrite() (previously declared in /*****/*****/public_html/sites/all/modules/fb/fb_settings.inc:57) in /*****/*****/public_html/modules/og_vocab/og_vocab.module on line 31
I looked into the og_vocab.module on the line provided in the error message and the code for the og_vocab module is as follows:
function custom_url_rewrite($op, $result, $path) {
if ($op == 'alias') {
if (arg(0) =="node" && arg(2) == "og" && arg(4) == "terms") {
// the system path to change or cloak
$patterns[0] = '!^admin/content/taxonomy/edit/term/(\d+)$!';
// the new cloaked name
$replacements[0] = 'node/'. arg(1) .'/og/vocab/edit/term/\1';
return preg_replace($patterns, $replacements, $path);
}
}
if ($op == 'source') {
// Do nothing.
}
// Do not forget to return $result!
return $result;
}What might you suggest I do about this?
Many thanks.
Comments
#1
In drupal, custom_url_rewrite is not a hook. There can be only one function by that name. So no module should define it. So its a bug in og vocab, if that is what it's doing.
See the Drupal for Facebook custom_url_rewrite as an example, its defined this way:
if(!function_exists('custom_url_rewrite')) {function custom_url_rewrite($type, $path, $original) {
return fb_settings_url_rewrite($type, $path, $original);
}
}
To solve your problem, modify og vocab to do something similar. Then, define your own custom_url_rewrite in your settings.php which calls fb_settings_url_rewrite() and the equivalent function for og vocab. Be careful to call the two functions in the proper order. Use one order for the alias op and reverse order for the source op. This is not trivial stuff so you have to be careful.