Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Awards System] Split up awards
Author Message
Nickman Online
Manager
*******
Management

Posts: 2,675
Joined: May 2008
Reputation: 69
Post: #1
[Awards System] Split up awards
If you are like most people, you want only a few awards per line and then have a line break to break them up. This will make that happen for you 001_smile

Open inc/plugins/awards.php, replace this:

PHP Code:
function awards_post()
{
    global 
$templates,$mybb,$db,$awards;
    if (
$mybb->settings['enableawards'] == AND $mybb->settings['awards_on_postbit'] !='0')
    {
        
$getAwards=$db->query("SELECT g.*, a.* FROM ".TABLE_PREFIX."awards_given AS g LEFT JOIN ".TABLE_PREFIX."awards AS a ON(g.award_id=a.id)");
        
$count=array();
        while (
$award=$db->fetch_array($getAwards))
        {
        
$to=$award['to_uid'];
            if ((
$count[$to] <= $mybb->settings['awards_on_postbit']) OR $mybb->settings['awards_on_postbit'] == '-1')
            {
                
$awards[$to].="<a href='award.php?id={$award[gid]}' title='{$award[name]}'><img src='{$mybb->settings['bburl']}/images/awards/$award[image]' title='award image' border='0'/></a> &nbsp;";
            }
            
$count[$to]++;
        }
    }


with this:
PHP Code:
function awards_post()
{
    global 
$templates,$mybb,$db,$awards;
    if (
$mybb->settings['enableawards'] == AND $mybb->settings['awards_on_postbit'] !='0')
    {
        
$getAwards=$db->query("SELECT g.*, a.* FROM ".TABLE_PREFIX."awards_given AS g LEFT JOIN ".TABLE_PREFIX."awards AS a ON(g.award_id=a.id)");
        
$count=array();
        
$i=1;
        while (
$award=$db->fetch_array($getAwards))
        {
            
$to=$award['to_uid'];
            if ((
$count[$to] <= $mybb->settings['awards_on_postbit']-1) OR $mybb->settings['awards_on_postbit'] == '-1')
            {
                
$awards[$to].="<a href='award.php?id={$award[gid]}' title='{$award[name]}'><img src='{$mybb->settings['bburl']}/images/awards/$award[image]' title='award image' border='0'/></a> &nbsp;";
            }
            if (
$i == NUMBER_PER_LINE_HERE)
            {
                
$awards[$to].="<br />";
                
$i=1;
            }
else
{
$i++;
}
            
$count[$to]++;
        }
    }


Make sure you change NUMBER_PER_LINE_HERE into a number, then save and done!
11-01-2009, 06:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Ajdija Offline
Member
***

Posts: 154
Joined: Jul 2009
Reputation: 0
Post: #2
RE: [Awards System] Split up awards
great tut Nickman! thx!
11-01-2009, 08:10 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Chrissy Offline
Member
***

Posts: 93
Joined: Mar 2009
Reputation: 0
Post: #3
RE: [Awards System] Split up awards
Thanks for this 001_smile
11-02-2009, 05:08 AM
Find all posts by this user Quote this message in a reply
alvarorojas4 Offline
Member
***

Posts: 92
Joined: Oct 2008
Reputation: 0
Post: #4
RE: [Awards System] Split up awards
OMG
Thanks a lot for this 001_smile
11-07-2009, 09:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Skiilz Offline
Member
***

Posts: 131
Joined: Sep 2009
Reputation: 0
Post: #5
RE: [Awards System] Split up awards
Thank you nick. I was looking for this.
(This post was last modified: 11-25-2009, 02:49 AM by Skiilz)
11-25-2009, 02:49 AM
Find all posts by this user Quote this message in a reply
telters Offline
Junior Member
**

Posts: 27
Joined: Jan 2010
Reputation: 0
Post: #6
RE: [Awards System] Split up awards
Thanks!
01-29-2010, 02:12 PM
Find all posts by this user Quote this message in a reply
butterfly44 Offline
Junior Member
**

Posts: 2
Joined: Jan 2010
Reputation: 0
Post: #7
RE: [Awards System] Split up awards
Sweeet. Heart thank u
01-30-2010, 01:04 PM
Find all posts by this user Quote this message in a reply
santanu18 Offline
Junior Member
**

Posts: 10
Joined: Feb 2010
Reputation: 0
Post: #8
RE: [Awards System] Split up awards
Thanks a lot.
02-01-2010, 05:17 AM
Find all posts by this user Quote this message in a reply
Devilson Offline
Junior Member
**

Posts: 20
Joined: Feb 2010
Reputation: 0
Post: #9
RE: [Awards System] Split up awards
Is this for labroccas plugin?
02-04-2010, 09:29 PM
Find all posts by this user Quote this message in a reply
Mr-Trainor Offline
Member
***

Posts: 243
Joined: Mar 2010
Reputation: 6
Post: #10
RE: [Awards System] Split up awards
(02-04-2010 09:29 PM)Devilson Wrote:  Is this for labroccas plugin?

It's for nickman's awards plugin 001_smile
--
Thanks for this! I'm gonna change it now Big Grin
04-04-2010, 11:47 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)