public function action_unsubscribe() { $id_subscribe = $this->request->param('id'); $subscription = new Model_Subscribe($id_subscribe); if ($subscription->loaded() and $subscription->id_user == Auth::instance()->get_user()->id_user) { try { $subscription->delete(); Alert::set(Alert::SUCCESS, __('You are unsubscribed')); } catch (Exception $e) { throw HTTP_Exception::factory(500, $e->getMessage()); } //unsusbcribe from elasticemail if (Core::config('email.elastic_listname') != '') { ElasticEmail::subscribe(Core::config('email.elastic_listname'), Auth::instance()->get_user()->email); } $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'subscriptions'))); } }
public function action_unsubscribe() { $id_subscribe = $this->request->param('id'); $subscription = new Model_Subscribe($id_subscribe); if ($subscription->loaded()) { try { $subscription->delete(); Alert::set(Alert::SUCCESS, __('You are unsubscribed')); $this->request->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'subscriptions'))); } catch (Exception $e) { throw new HTTP_Exception_500($e->getMessage()); } } }