Radio Streaming - 50% Lifetime Discount with purchase of any Joomla Web Radio Addon. Discount Code: STR15-Z
See Radio Streaming Plans

Results 1 to 2 of 2

Thread: Trophy shown by name

  1. #1

    Trophy shown by name

    Hi,

    Looking at the site http://leagues.gr/football-game?view...n=26&league=18 it shows trophies next to user names in tables, how do I get this to show the same on my site ? I have 2 users who have won trophies but only shows when you go into their stats.
    Might be missing an option somewhere.

    Regards

  2. #2
    Administrator
    Join Date
    Jul 2015
    Posts
    65
    Hello,

    this change will require changes to an encoded file, i will attach this file without encoding and you will have to place it in the directory <joomla installation>/components/com_masterleaguepro/views/standings/
    Unzip the file first
    file_to_replace_UNZIP_FIRST.zip

    then you will have to change the file <joomla installation>/components/com_masterleaguepro/views/standings/tmpl/default.php

    ~ Line 122
    Code:
    <td><a href='<?php echo jRoute::_("index.php?option=com_masterleaguepro&view=playerprediction&user=".$item->id); ?>'><?php echo $item->username;?></a></td>
    to
    Code:
    <td class='mlp-left'>
        <a href='<?php echo jRoute::_("index.php?option=com_masterleaguepro&view=playerprediction&user=".$item->id); ?>'>
        <?php echo $item->username;?>
        </a>
        <?php
        if(isset($this->trophies[$item->id])){
    
    
            //user got trophy (we got 3 type of trophies with id 1,2 and 3)
            if(isset($this->trophies[$item->id][1])){
                for($j=0;$j<$this->trophies[$item->id][1]["trophy_count"];$j++){
                    echo "<img alt='".$this->trophies[$item->id][1]["trophy_desc"]."' title='".$this->trophies[$item->id][1]["trophy_desc"]."' src='".$this->trophies[$item->id][1]["trophy_icon"]."'/>";
                }
            }
            if(isset($this->trophies[$item->id][2])){
                for($j=0;$j<$this->trophies[$item->id][2]["trophy_count"];$j++){
                    echo "<img alt='".$this->trophies[$item->id][2]["trophy_desc"]."' title='".$this->trophies[$item->id][2]["trophy_desc"]."' src='".$this->trophies[$item->id][2]["trophy_icon"]."'/>";
                }
            }
            if(isset($this->trophies[$item->id][3])){
                for($j=0;$j<$this->trophies[$item->id][3]["trophy_count"];$j++){
                    echo "<img alt='".$this->trophies[$item->id][3]["trophy_desc"]."' title='".$this->trophies[$item->id][3]["trophy_desc"]."' src='".$this->trophies[$item->id][3]["trophy_icon"]."'/>";
                }
            }
        }
        if(isset($this->trophies[$item->id][4])){
            for($j=0;$j<$this->trophies[$item->id][4]["trophy_count"];$j++){
                echo "<img alt='".$this->trophies[$item->id][4]["trophy_desc"]."' title='".$this->trophies[$item->id][4]["trophy_desc"]."' src='".$this->trophies[$item->id][4]["trophy_icon"]."'/>";
            }
        }
    ?>
    and last you will have to add code to the file <joomla installation>/components/com_masterleaguepro/models/standings.php
    you can place the following code before the closing bracket "}" (last line)

    Code:
    public function getTrophies(){
        $query="SELECT ut.user_id,t.id,t.icon,t.description,COUNT(*) as times ".
                " FROM `#__masterleaguepro_user_trophy` ut ".
                " INNER JOIN `#__masterleaguepro_trophies` t ON t.id=ut.trophy_id ".
                " GROUP BY user_id,trophy_id ";
    
    
        $this->db->setQuery($query);
        $trophyList=$this->db->loadObjectList();
    
    
        $returnArr=array();
    
    
        foreach ($trophyList as $i => $item) {
        $returnArr[$item->user_id][$item->id]=array("trophy_icon"=>$item->icon,"trophy_desc"=>$item->description,"trophy_count"=>$item->times);
        }
    
    
        return $returnArr;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •