I'm writing a custom module that creates a form to provide a simplified interface for users to update their subscriptions, but the form_submit function times out when it invokes the notifications_save_subscription function. It gets hung up when notifications_save_subscription calls the notifications_module_invoke function just before exiting. (If I comment out the notifications_module_invoke call, the timeout error goes away.)

Here's the code of my submit function:

<?php
function job_notifications_form_submit($form_id, $form_values) {
  $uid = $form_values['account']->uid;
//  notifications_delete_subscriptions(array('uid' => $uid));
  $default_options = array(
        'uid' => $uid,
        'type' => 'taxonomy',
        'event_type' => 'node',
        'conditions' => '1',
        'send_interval' => '0',
        'send_method' => 'mail',
        'cron' => '1',
        'module' => 'notifications',
        'status' => '1',
      );
  foreach ($form_values['subscriptions'] as $vid => $checkboxes) {
    foreach ($checkboxes as $tid => $value) {
      if ($value) {
        $subscription = $default_options;
        $subscription['fields'] = array();
        $subscription['fields']['tid'] = $tid;
        notifications_save_subscription($subscription);
      }
    }
  }
}
?>

Comments

jose reyero’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Some custom hook_notifications() causing the loop?

It will be called with ($op, $subscription)

jose reyero’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)