3

I want to display the reading history of nodes using Views.
For this reason there is a history module in core, but the history_cron hook deletes history older than 1 month.
I want to override this hook so that history is not deleted.
What should i do?

3

A module can avoid Drupal invokes a hook defined from another module, implementing hook_module_implements_alter(). For example, a module using history_ovverrides as machine name could use the following implementation of that hook.

function history_overrides_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'cron') {
    // Remove history_cron() from the list of the hook_cron() implementations.
    unset($implementations['history']);
  }
}

The same module could implement hook_cron() to delete the History module data basing on different criteria (for example, after 6 months).

| improve this answer | |
3

With Ultimate Cron you can problably disable it from running using its configuration form.

If you look at its API, it adds a hook_cron_alter that you could implement if you wanted to do it by code.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.