ChrisStatzer
New member
While I have a fairly good grasp of the structure of XF, I am primarily a python developer so I really have no good sense of "right and wrong" so to speak. I can look at something in Python and say "OMG thats crap!", but php not so much.
I am busy adding a thread rating system (you know the ones, with the little JS stars) and wanted to extend the Thread model. Here was my approach:
This looks like dammit to me.... Is this intended usage? It works fine. School me please.
Chris
I am busy adding a thread rating system (you know the ones, with the little JS stars) and wanted to extend the Thread model. Here was my approach:
PHP:
<?php
class ThreadRating_Model_ThreadRating extends XenForo_Model_Thread
{
public function prepareThread(array $thread, array $forum, array $nodePermissions = null, array $viewingUser = null) {
$thread = parent::prepareThread($thread, $forum, $nodePermissions, $viewingUser);
$thread['rating'] = 2; /* code to fetch avg rating here */
return $thread;
}
}
This looks like dammit to me.... Is this intended usage? It works fine. School me please.
Chris