X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Funsubscribe.php;h=fabb7148e1404a27a65b60740afced403d58bf0c;hb=59db378c9304293c380778a1eb59ece5fbacb590;hp=bac7523932e4e92e3eda81832f915c8430b5ea6a;hpb=52600ce0b063e68e622b19699841e41b5ddbf2d1;p=quix0rs-gnu-social.git diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php index bac7523932..fabb7148e1 100644 --- a/actions/unsubscribe.php +++ b/actions/unsubscribe.php @@ -37,16 +37,21 @@ class UnsubscribeAction extends Action { common_server_error(_t('Not subscribed!.')); } - $sub = new Subscription(); + $sub = DB_DataObject::factory('subscription'); + $sub->subscriber = $user->id; $sub->subscribed = $other->id; + $sub->find(true); + + // note we checked for existence above + if (!$sub->delete()) { common_server_error(_t('Couldn\'t delete subscription.')); return; } - common_redirect(common_local_url('all', array('nickname' => - $user->nickname))); + common_redirect(common_local_url('subscriptions', array('nickname' => + $user->nickname))); } }