Overriding taxnomony_access_db_rewrite_sql()

Events happening in the community are now at Drupal community events on www.drupal.org.
somebodysysop's picture

I've posted this in the Drupal Forums, but want to post it here as well.

As you know, I created patches to the node, og, and taxonomy_access modules which allow them to work together: http://groups.drupal.org/node/3700

What I want to do now is start removing some of these patches by putting the functionality I need into one separate module.

First up: taxonomy_access_db_rewrite_sql(). Curently, I patch this function in order to get the taxonomy_access module to display terms and nodes while respecting OG access control. What I would like to do is take this patched code, put it into another module, and have that module override the default taxonomy_access_db_rewrite_sql() function (therefore removing my need to patch it).

Put another way, I would like to have the db_rewrite_sql() function of Module B override (not add to or augment, but replace) the db_rewrite_sql() function of Module A.

Is this even possible? And if so, any suggestions on how would I go about doing it?

Thanks!

Comments

This has been done

somebodysysop's picture

The hook_db_rewrite_sql code which previously required that I patch the taxonomy_access and node modules has now been incorporated into OG User Roles. og_user_roles_db_rewrite_sql() now performs these tasks.

According to this response http://drupal.org/node/161299 and an email response to this issue I received from the Drupal Developers list, your module's hook_db_rewrite_sql() code can override that of another module's so long as:

a. The conditions are the same, and;
b. Your module is weighted heavier.

As you see from this comment (http://groups.drupal.org/node/4026), there is now only one patch required for TAC/OG integration, and the only reason that patch is required is because we couldn't get it into Drupal 6 core: http://drupal.org/node/143075. Trying for Drupal 7 core.

Still a long way from where we'd like to be, but so far I have 4 access control mechanisms working together:

  1. OG User Roles
  2. Taxonomy Access Control
  3. OG
  4. Content Access

with, so far, only one patch required. Long way to go, but have come quite far.

Access Control

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: