/** * Activate subscription * If there is error,set 'error_message' to the template, * If activation succeeds, set 'subscriber' to the template * @param string: $hashString * @return void */ public function activateSubscription($hashString) { // 1. fetch the subscription object $subscription = ezcomSubscription::fetchByHashString($hashString); if (is_null($subscription)) { $this->tpl->setVariable('error_message', ezpI18n::tr('ezcomments/comment/activate', 'There is no subscription with the hash string!')); } else { if ($subscription->attribute('enabled')) { ezDebugSetting::writeNotice('extension-ezcomments', 'Subscription activated', __METHOD__); } $subscriber = ezcomSubscriber::fetch($subscription->attribute('subscriber_id')); if ($subscriber->attribute('enabled')) { $subscription->enable(); $this->tpl->setVariable('subscriber', $subscriber); } else { $this->tpl->setVariable('error_message', ezpI18n::tr('ezcomments/comment/activate', 'The subscriber is disabled!')); } } }