'name' => 'subscribeto',
'type' => 'hidden',
'value' => $profile->nickname));
- common_element('input', array('type' => 'submit', 'value' => _t('Subscribe')));
+ common_element('input', array('type' => 'submit',
+ 'class' => 'button',
+ 'value' => _t('Subscribe')));
common_element_end('form');
}
'name' => 'unsubscribeto',
'type' => 'hidden',
'value' => $profile->nickname));
- common_element('input', array('type' => 'submit'), _t('Unsubscribe'));
+ common_element('input', array('type' => 'submit',
+ 'class' => 'button',
+ 'value' => _t('Unsubscribe')));
common_element_end('form');
}
$sub->created = DB_DataObject_Cast::dateTime(); # current time
- $val = $sub->validate();
-
- if ($val !== TRUE) {
- # XXX: give some error notice
- common_server_error(_t('Subscription did not validate.'));
- return;
- }
-
if (!$sub->insert()) {
common_server_error(_t('Couldn\'t create subscription.'));
return;
}
- common_redirect(common_local_url('all', array('nickname' =>
- $user->nickname)));
+ common_redirect(common_local_url('subscriptions', array('nickname' =>
+ $user->nickname)));
}
}
\ No newline at end of file
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)));
}
}