class pinAwardsProMiniProfileCab extends skin_global(~id~) { function userInfoPane($author, $contentid, $options) { $output = parent::userInfoPane($author, $contentid, $options); if(intval($contentid) != 0 && $this->registry->getCurrentApplication() == 'forums') { // Make sure that the system is on if($this->settings['awards_system_on_off'] == 1 && $this->settings['awards_show_topic_type'] == 'PRO' && $this->settings['awards_show_topic_view'] == 1) { // Load our Language File: $this->registry->class_localization->loadLanguageFile( array( 'public_awards' ), 'awards' ); // Get everything we could possibly need for this in one mega query $this->DB->build( array( 'select' => 'DISTINCT t.awards_id', 'from' => array( 'awarded' => 't' ), 'order' => 't.awarded_date DESC', 'where' => "t.awards_user_id='{$author['member_id']}'", 'add_join' => array( array( 'select'=> 'p.awards_img_url, p.awards_cat_id, p.awards_name', 'from' => array( 'awards' => 'p' ), 'where' => "p.awards_id=t.awards_id", 'type' => 'left', ), array( 'select'=> 'i.*', 'from' => array( 'permission_index' => 'i' ), 'where' => "i.app='awards' AND i.perm_type='cat' AND i.perm_type_id=p.awards_cat_id", 'type' => 'left', ), ) ) ); $o = $this->DB->execute(); // Do we have a display limit? if((int) $this->settings['awards_display_limit'] > 0) { $limit = (int) $this->settings['awards_display_limit']; } else { $limit = 0; } $count = 0; // Assign the rows to the necessary variables. Make sure only to assign those that the viewer can see. while( $row = $this->DB->fetch( $o ) ) { $f['perm_id'] = $row['perm_id']; $f['app'] = $row['app']; $f['perm_type'] = $row['perm_type']; $f['perm_type_id'] = $row['perm_type_id']; $f['perm_view'] = $row['perm_view']; $f['perm_2'] = $row['perm_2']; $f['perm_3'] = $row['perm_3']; $f['perm_4'] = $row['perm_4']; $f['perm_5'] = $row['perm_5']; $f['perm_6'] = $row['perm_6']; $f['perm_7'] = $row['perm_7']; $f['owner_only'] = $row['owner_only']; $f['friend_only'] = $row['friend_only']; $f['authorized_users'] = $row['authorized_users']; // Only show the awards the user can view that go up to the limit if($this->registry->permissions->check( 'view', $f )) { if($count < $limit || $limit == 0) { $count ++; $awards[$author['member_id']][$count]['img_url'] = $row['awards_img_url']; $awards[$author['member_id']][$count]['name'] = $row['awards_name']; $awards[$author['member_id']][$count]['id'] = $row['awards_id']; } } } if(is_array($awards[$author['member_id']])) { $awardhtml = ""; foreach($awards[$author['member_id']] as $award){ $awardhtml .= $this->registry->getClass('output')->getTemplate('awards')->BoxAward( $award['id'] , $award['name'] , $award['img_url'] ); } $output .= $this->registry->getClass('output')->getTemplate('awards')->MiniProBox($awardhtml,$author['member_id']); } } } return $output; } }