3 class UnsubscribeAction extends Action {
4 function handle($args) {
6 if (!common_logged_in()) {
7 common_user_error(_t('Not logged in.'));
10 $other_nickname = $this->arg('unsubscribeto');
11 $other = User::staticGet('nickname', $other_nickname);
13 common_user_error(_t('No such user.'));
17 $user = common_current_user();
19 if (!$user->isSubscribed($other)) {
20 common_server_error(_t('Not subscribed!.'));
23 $sub = new Subscription();
24 $sub->subscriber = $user->id;
25 $sub->subscribed = $other->id;
27 if (!$sub->delete()) {
28 common_server_error(_t('Couldn\'t delete subscription.'));
32 common_redirect(common_local_url('all', array('nickname' =>