- $other = User::staticGet('nickname', $other_nickname);
- if (!$other)
- return _('No such user.');
+function subs_unsubscribe_user($user, $other_nickname)
+{
+
+ $other = User::staticGet('nickname', $other_nickname);
+
+ if (!$other) {
+ return _('No such user.');
+ }
+
+ return subs_unsubscribe_to($user, $other->getProfile());
+}
+
+/* Unsubscribe user $user from profile $other
+ * NB: other can be a remote user. */
+
+function subs_unsubscribe_to($user, $other)
+{
+ if (!$user->isSubscribed($other))
+ return _('Not subscribed!');