summaryrefslogtreecommitdiff
path: root/actions/unsubscribe.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-21 14:56:02 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-21 14:56:02 -0400
commitb791a835929c659d8dcf174553f7786fb45cf978 (patch)
tree7000715f987b456d401791898b615bb4f3b97c8d /actions/unsubscribe.php
parent5172a73e28eb2150967f466341ac1e0f7725d896 (diff)
fix subscriptions a bit
darcs-hash:20080521185602-84dde-9e058c34c251d96cf557c1dd459523aa434bed79.gz
Diffstat (limited to 'actions/unsubscribe.php')
-rw-r--r--actions/unsubscribe.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index bac752393..fabb7148e 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)));
}
}