- $sub = new Subscription();
- $sub->subscriber = $user->id;
- $sub->subscribed = $other->id;
-
- $sub->created = DB_DataObject_Cast::dateTime(); # current time
-
- if (!$sub->insert()) {
- common_server_error(_t('Couldn\'t create subscription.'));
+ if (!$token || $token != common_session_token()) {
+ $this->client_error(_('There was a problem with your session token. Try again, please.'));
+ return;
+ }
+
+ $other_nickname = $this->arg('subscribeto');
+
+ $result=subs_subscribe_user($user, $other_nickname);
+ if($result != true) {
+ common_user_error($result);