/** * Override parent method * * @return bool */ protected function is_vote_buttons_enabled() { parent::is_vote_buttons_enabled(); require_once DIR . '/includes/functions_socialgroup.php'; $discussion = fetch_socialdiscussioninfo($this->item['discussionid']); $group = fetch_socialgroupinfo($discussion['groupid']); if (can_post_new_message($group)) { } else { $this->error_msg = 'vbv_post_can_not_be_voted'; } if (!empty($this->error_msg)) { return false; } return true; }
case 'vBForum_Post': $target = fetch_postinfo($target_id); break; case 'vBForum_SocialGroupMessage': if ($vbulletin->options['vbv_enable_sg_votes']) { require_once DIR . '/includes/functions_socialgroup.php'; $target = fetch_groupmessageinfo($target_id); break; } default: standard_error(fetch_error('vbv_unsupported_type', $vbulletin->options['contactuslink'])); } $permitted_actions = array('vote', 'remove'); if (in_array($_REQUEST['do'], $permitted_actions)) { // Init vote manager class $vote_manager = vtVotes::get_instance(VOTE_CONTENT_TYPE, $target); $need_ajax_response = TRUE; } if ($_REQUEST['do'] == 'vote') { $vbulletin->input->clean_array_gpc('r', array('value' => TYPE_BOOL)); // check are negative votes forbidden if (!$vbulletin->GPC['value'] and !$vbulletin->options['vbv_enable_neg_votes']) { standard_error(fetch_error('vbv_try_neg_vote')); } // if user can't vote for this item, throw standart error if (!$vote_manager->can_add_vote()) { $vote_manager->show_error(); } // save vote into db $value = $vbulletin->GPC['value'] ? '1' : '-1'; $vote_manager->add_vote($value);