MyBB Source


MyBB 1.4 Support Now Discontinued

Latest Releases: [For 1.6] Mark Thread Read - [For 1.6] Guest Access - [For 1.6] Awards System v2.0

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



Posts: 2,406
Joined: May 2008
Reputation: 48
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

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
Ajdija
Member


Posts: 195
Joined: Jul 2009
Reputation: 0
Post: #2
RE: [Awards System] Split up awards
great tut Nickman! thx!

[Image: current_rotatesignature.png]
11-01-2009 08:10 AM
Chrissy
Member


Posts: 96
Joined: Mar 2009
Reputation: 0
Post: #3
RE: [Awards System] Split up awards
Thanks for this
11-02-2009 05:08 AM
alvarorojas4
Member


Posts: 80
Joined: Oct 2008
Reputation: 0
Post: #4
RE: [Awards System] Split up awards
OMG
Thanks a lot for this

11-07-2009 09:39 PM
Skiilz
Member


Posts: 153
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
telters
Junior Member


Posts: 30
Joined: Jan 2010
Reputation: 0
Post: #6
RE: [Awards System] Split up awards
Thanks!

Check out my website! http://www.grantman.ca It's a blog I Have

[Image: 468_60link_bucks.gif]
01-29-2010 02:12 PM
butterfly44
Junior Member


Posts: 2
Joined: Jan 2010
Reputation: 0
Post: #7
RE: [Awards System] Split up awards
Sweeet. thank u

party supplies
01-30-2010 01:04 PM
santanu18
Junior Member


Posts: 12
Joined: Feb 2010
Reputation: 0
Post: #8
RE: [Awards System] Split up awards
Thanks a lot.
02-01-2010 05:17 AM
Devilson
Junior Member


Posts: 22
Joined: Feb 2010
Reputation: 0
Post: #9
RE: [Awards System] Split up awards
Is this for labroccas plugin?
02-04-2010 09:29 PM
Mr-Trainor
Member


Posts: 124
Joined: Mar 2010
Reputation: 0
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
--
Thanks for this! I'm gonna change it now
04-04-2010 11:47 PM
 





Artist Community | GFX forums