Is there any way to override regular functions that don't start with 'theme_' ? I'm trying to get rid of all my hacks in the core modules to clean up my site. There are a couple functions where I just want to change an sql query. I suppose I could pretty easily make a module to replace some functionality, but for a couple lines of code, I'd rather not go through the hassle. Any ideas?

Comments

dman’s picture

Short answer: no.

PHP doesn't play to happy with that idea. If you've gotta hack the core, the core will remain hacked.
I've done magical conditional includes before now, but I would be interested if anyone has any other insight on this.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

nedjo’s picture

See this issue for some of the previous discussion: http://drupal.org/node/29428.

The tools we have available for overriding and extending include:

1. Use hook_db_rewrite_sql(). Can this help modify the queries you have in mind? (Only available if those queries are run through db_rewrite_sql().)

2. Override a menu item. Available if the function you're trying to override is called by a menu item. In a module with a higher weight than the module whose function you're overiding, redefine the menu item in a _menu hook, putting a new function (likely, a modified version of the original one) as the callback.

3. hook_form_alter.