public static function canBeFollower()
 {
     if (!CMA_Settings::getOption(CMA_Settings::OPTION_ENABLE_CATEGORY_FOLLOWING)) {
         return false;
     }
     return CMA_FollowersEngine::canBeFollower();
 }
 public static function canBeFollower($userId = null)
 {
     if (!CMA_Settings::getOption(CMA_Settings::OPTION_ENABLE_THREAD_FOLLOWING)) {
         return false;
     } else {
         return CMA_FollowersEngine::canBeFollower($userId);
     }
 }
 protected static function _processFollow()
 {
     $result = array('success' => 0, 'message' => CMA::__('An error occurred.'));
     if (empty($_POST['nonce']) or !wp_verify_nonce($_POST['nonce'], 'cma_follow')) {
         $result['message'] = CMA::__('Invalid nonce.');
     } else {
         if (!empty(self::$query->post) and $thread = CMA_Thread::getInstance(self::$query->post->ID) and empty($_POST['categoryId'])) {
             $followersEngine = $thread->getFollowersEngine();
             if ($thread->canSubscribe()) {
                 if ($followersEngine->isFollower()) {
                     $followersEngine->removeFollower();
                     $result = array('success' => 1, 'message' => CMA_Labels::getLocalized('unfollow_success'), 'isFollower' => false);
                 } else {
                     $followersEngine->addFollower();
                     $result = array('success' => 1, 'message' => CMA_Labels::getLocalized('follow_success'), 'isFollower' => true);
                 }
             }
         } else {
             if (CMA_Settings::getOption(CMA_Settings::OPTION_ENABLE_CATEGORY_FOLLOWING) and !empty($_POST['categoryId']) and $category = CMA_Category::getInstance($_POST['categoryId'])) {
                 $followersEngine = $category->getFollowersEngine();
                 if (CMA_FollowersEngine::canBeFollower()) {
                     if ($followersEngine->isFollower()) {
                         $followersEngine->removeFollower();
                         $result = array('success' => 1, 'message' => CMA_Labels::getLocalized('unfollow_category_success'), 'isFollower' => false);
                     } else {
                         $followersEngine->addFollower();
                         $result = array('success' => 1, 'message' => CMA_Labels::getLocalized('follow_category_success'), 'isFollower' => true);
                     }
                 }
             }
         }
     }
     header('Content-type: application/json');
     echo json_encode($result);
     exit;
 }