Gantry and Broken Link Checker don't work together
Posted 12 years 1 month ago
I opened a ticket on this in the Modulus forum and got no response, so I'm trying here, since I believe this is a Gantry-related problem. I have a WordPress 3.4.1 site running the Modulus 1.0 theme, using Gantry 1.25. It also has the Broken Link Checker 1.6.2 plug-in installed, but currently deactivated. This is a test site, I'm trying to redesign a production site that does use Broken Link Checker but doesn't currently use Gantry or Modulus.
Working on the site in June, I got this error:
Fatal error: Cannot redeclare add_screen_meta_link() (previously declared in /home/content/16/6136616/html/wp-content/plugins/broken-link-checker/includes/screen-meta-links.php:256) in /home/content/16/6136616/html/wp-content/plugins/gantry/admin/screen-meta-links.php on line 205
I Googled it then and found the suggestion that I open the Gantry version of the file and move the endif; to just before the ?> at file end. I did this; I also had to actually delete the last function in the Gantry file; and then everything seemed to work, in the sense that I could access the site and the menus worked.
I went on vacation, returned, and ran a bunch of plug-in upgrades. The error came back when I tried to hit the Return to WP Upgrades link:
Fatal error: Cannot redeclare add_screen_meta_link() (previously declared in /home/content/16/6136616/html/wp-content/plugins/broken-link-checker/includes/screen-meta-links.php:256) in /home/content/16/6136616/html/wp-content/plugins/gantry/admin/screen-meta-links.php on line 205
When I looked at the Gantry version of screen-meta-links.php, I saw that the file had changed, there are now two ?> statements in it, and moving the endif; doesn't work. I downloaded both versions of screen-meta-links.php, from Gantry and from Broken Link Checker, and compared them in WinMerge. They seem to be different versions of the same utility, both written by Janis Elsts - Gantry is using a 2010 version and Broken Link Checker is using a 2011 version, substantially changed.
I am not a PHP expert and this isn't something I can fix. As things stand I can't use both Broken Link Checker and Gantry; and we use the link checker a lot on the production site. Any suggestions?? With both plug-ins active, the site is completely unusable, all anyone can see is the fatal error code.
Re: Gantry and Broken Link Checker don't work together
Posted 12 years 1 month ago
What is happening is that both Gantry and the other plugin are using a function with the exact same name, which is a no-no in PHP - it results in a Fatal error. Unless modifications are made to one of the two plugins, they won't work together. Anytime you update Gantry, and changes you've made to the core files are removed, so we don't recommend that.
If you want to provide FTP access and login information to the site I can try a few things. I can't guarantee a fix, but I can take a look and see if there is an easy solution.
The difficult we do immediately, the impossible takes a little longer.
Re: Gantry and Broken Link Checker don't work together
Posted 12 years 1 month ago
Hi, PM me the information - push the PM button under my avatar to send a private message.
I can't provide my email address to forum members, it's easier if you give me an existing login. I have no use for it other than to try and fix your website and will not use it for any other reason.
The difficult we do immediately, the impossible takes a little longer.
Re: Gantry and Broken Link Checker don't work together
Posted 12 years 1 month ago
Alright, I got in there. I just commented out the entire add_screen_meta_link() function at the very bottom of the Gantry file. I did try a few other things as well, but that was the easy fix to get your site out of the fatal error.
However, this approach is not recommended. As you found, when updating Gantry any changes made to the core files will be lost. Also, I'm not exactly sure what Gantry needs this for - I'm guessing it's there for a reason, otherwise it wouldn't be there at all.
I tried the same fix on the Link Checker plugin files and the plugin won't run without that file intact - not without editing more files anyway. I didn't want to get into hacking up too many files. Part of the issue is that they are two different versions of the same thing - the if conditionals are not checking for the same versions.
I did some searching on this error, I found your post on the WP forum, along with several others having the same issue with various other plugins. It just seems like the implementation of this function in the Link Checker is taking over anything else that uses it as well.
I would not take the advice you were given in the WP forum of modifying Gantry to not include this file - or change any core files in Gantry unless absolutely necessary. Gantry runs your whole website, this other plugin is a utility at best. Makes more sense to make changes to the lesser of the two, instead of hacking up your framework core to accommodate a utility. That's just my opinion.
The difficult we do immediately, the impossible takes a little longer.
Re: Gantry and Broken Link Checker don't work together
Posted 12 years 3 weeks ago
Thanks for the response; this kind of got away from me for a bit. I'm under pressure to put the theme into production, but I definitely want to keep the Link Checker. I can use your fix for now, and I'll certainly document it; but the last time I did this, I got a Gantry update, and the file had changed, and my fix no longer worked. You've now developed a new fix but the exposure to Gantry updates is still there.
I would really like to see Gantry stop conflicting with my existing tool, especially since you yourself aren't sure why the function is there. Any chance of that happening, say by changing the name of the routine that's called?? I can try to open a fix with Broken Link Checker but frankly, WordPress support doesn't respond as well as you do! Yes, the link checker is a "utility at best," but it's an extremely useful utility on our site, as our users constantly put links in the blog posts, some of which are mistyped. As far as I know BLC is the only one out there that does what it does. Google searches only turn up it.
Re: Gantry and Broken Link Checker don't work together
Posted 12 years 3 weeks ago
I understand what you're saying, but we're not going to remove code from Gantry to accommodate a third party utility. You could say that Gantry is conflicting with it just as easy as we could say it's conflicting with Gantry - it depends on how you look at it. In the overall scheme of things, Gantry is doing more for your website than the link checker is, so it may be easier to find a replacement for the utility than it is to redo your entire website. That's the basis of my earlier suggestions. Bottom line is that we don't guarantee compatibility with any third party product.
I can ask the developers what that code is doing and if it can be updated. Just because I personally do not know what it does not mean it's not important - it's there for a reason. I'm a moderator, I just answer questions, I don't program all the code. From what I saw on the forums regarding this plugin, it has issues with several other products, not just Gantry. I don't know if I resolve it for you other than the fixes I provided earlier.
The difficult we do immediately, the impossible takes a little longer.