/**
  * Unsubscribe specific user from a given object
  *
  * @param void
  * @return null
  */
 function unsubscribe_user()
 {
     if (!$this->active_object->canEdit($this->logged_user)) {
         $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall());
     }
     // if
     if ($this->request->isSubmitted()) {
         $user = null;
         $user_id = (int) $this->request->get('user_id');
         if ($user_id) {
             $user = Users::findById($user_id);
         }
         // if
         if (!instance_of($user, 'User')) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         $subscription = Subscriptions::findById(array('user_id' => $user->getId(), 'parent_id' => $this->active_object->getId()));
         if (!instance_of($subscription, 'Subscription')) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         $delete = $subscription->delete();
         if ($delete && !is_error($delete)) {
             flash_success(':user_name has been unsubscribed from :object_name :object_type', array('user_name' => $user->getDisplayName(), 'object_name' => $this->active_object->getName(), 'object_type' => $this->active_object->getVerboseType(true)));
         } else {
             flash_error('Failed to unsubscribe :user_name from :object_name :object_type', array('user_name' => $user->getDisplayName(), 'object_name' => $this->active_object->getName(), 'object_type' => $this->active_object->getVerboseType(true)));
         }
         // if
         $this->redirectToReferer($this->active_object->getSubscriptionsUrl());
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }