<?php
//######################## Reputation System By Borbole ###########################
class Borbole_Reputation_Model_Thread extends XFCP_Borbole_Reputation_Model_Thread
{
public function example()
{
$thread = array(
'thread_id' => 1,
'node_id' => 1,
'user_id' => 1,
'reputation_count' => 0, // This comes from the xf_forum columm shown for example only
'reputation_count' => 2 // This comes from the xf_user column. This becomes the only reputation_count field set in the array.
);
$forum = array(
'thread_id' => 1,
'node_id' => 1,
'user_id' => 1,
'reputation_count' => 0, // This comes from the xf_forum columm shown for example only
'reputation_count' => 2 // This comes from the xf_user column. This becomes the only reputation_count field set in the array.
);
$canViewThread = $this->canViewThread($thread, $forum);
Zend_Debug::dump($canViewThread); // returns false;
}
public function canViewThread(array $thread, array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
{
$visitor = XenForo_Visitor::getInstance();
// reputation_count isset in the $forum array and the value is 2.
if(isset($forum['reputation_count']) AND $forum['reputation_count'] != 0)
{
// $visitor reputation_count is 2. $forum reputation_count is 2.
if($visitor['reputation_count'] <= $forum['reputation_count'] AND !XenForo_Visitor::getInstance()->hasPermission('reputation', 'exlude_forum_rep'))
{
$errorPhraseKey = array('num_rep_forum', 'username' => $visitor['username'],
'repforum' => $forum['reputation_count'],
'repcount' => $visitor['reputation_count']
);
return false;
}
}
return parent::canViewThread($thread, $forum, $errorPhraseKey, $nodePermissions, $viewingUser);
}
}