Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have some old D6 code which I am converting to D7.
The code does something like this:
if ( !notifications_get_subscriptions(array('type' => $type, 'uid' => $account->uid), array($field => $value))) {
$subscription = array(
'uid' => $account->uid,
'type' => $type,
'fields' => array($field => $value),
);
notifications_save_subscription($subscription);
But in D7, it now in produces an error:
Call to a member function set_subscription() on a non-object in ...\sites\all\modules\notifications\notifications.subscription.inc on line 1152
Please can anyone confirm if the hooks have changed? I could not see any changes. Thanks
Comments
Comment #2
zeezhao CreditAttribution: zeezhao commentedJust found some documentation for D7 api here: https://www.drupal.org/node/1711802
Will try this out.
edit:
Now gives:
even though including the required classes and doing as suggested:
Comment #3
zeezhao CreditAttribution: zeezhao commented