3 class SubscribeAction extends Action {
4 function handle($args) {
7 if (!common_logged_in()) {
8 common_user_error(_t('Not logged in.'));
12 $other_nickname = $this->arg('subscribeto');
14 $other = User::staticGet('nickname', $other_nickname);
17 common_user_error(_t('No such user.'));
21 $user = common_current_user();
23 if ($user->isSubscribed($other)) {
24 common_user_error(_t('Already subscribed!.'));
28 $sub = new Subscription();
29 $sub->subscriber = $user->id;
30 $sub->subscribed = $other->id;
32 $sub->created = time();
34 if (!$sub->insert()) {
35 common_server_error(_t('Couldn\'t create subscription.'));
39 common_redirect(common_local_url('all', array('nickname' =>