Page 1 of 1

Progession Awards

Posted: Mon Aug 18, 2014 10:15 am
by Lasarian
Little glitch with awards like the Forum Ribbon that have multiple variants and are likely to be awarded to the same person more than once, the display on the shadowbox looks for the award number in the member's field and apparently when it comes across the first number is just happy with that and stops, so I had to go into the database and remove the first version of the ribbon in Talo and Tundrra's award fields.

Just FYI, I think this is a simple fix I just have to get to it.

Re: Progession Awards

Posted: Mon Aug 18, 2014 12:06 pm
by Tundrra
I have not look at the code or anything so I'm just blowing smoke.

If the award is looking at a recordset and filtering just forum_post_awards, by default it would order by lowest to highest awarded. If that's the case adding a DESC onto the end of the query so it showed you the highest post award first that is currently being assigned to the playerID.

Re: Progession Awards

Posted: Mon Aug 18, 2014 1:12 pm
by Lasarian
Tundrra wrote:I have not look at the code or anything so I'm just blowing smoke.

If the award is looking at a recordset and filtering just forum_post_awards, by default it would order by lowest to highest awarded. If that's the case adding a DESC onto the end of the query so it showed you the highest post award first that is currently being assigned to the playerID.
Would I accomplish the same objective if I just renumbered the awards to make the most recent one a lower number than the previous?

Re: Progession Awards

Posted: Mon Aug 18, 2014 2:14 pm
by Tundrra
Lasarian wrote:
Tundrra wrote:I have not look at the code or anything so I'm just blowing smoke.

If the award is looking at a recordset and filtering just forum_post_awards, by default it would order by lowest to highest awarded. If that's the case adding a DESC onto the end of the query so it showed you the highest post award first that is currently being assigned to the playerID.
Would I accomplish the same objective if I just renumbered the awards to make the most recent one a lower number than the previous?
Yes I imagine so:)

Re: Progession Awards

Posted: Mon Aug 18, 2014 2:51 pm
by Tundrra
How ever if you change the award_id any member who has received one of those award IDs you change could be effected.

Re: Progession Awards

Posted: Tue Aug 19, 2014 8:30 am
by Lasarian

Code: Select all

					<?php if(in_array('9', $awardArray)): ?>
						<img src="../modules/image.php?width=75&image=/images/awards/award_1000_Posts.png" align="center" title="Forum Ribbon: 1,000">
					<?php elseif(in_array('24', $awardArray)): ?>
						<img src="../modules/image.php?width=75&image=/images/awards/award_2500_Posts.png" align="center" title="Forum Ribbon: 2,500">
					<?php elseif(in_array('27', $awardArray)): ?>
						<img src="../modules/image.php?width=75&image=/images/awards/award_5000_Posts.png" align="center" title="Forum Ribbon: 5,000">
					<?php elseif(in_array('28', $awardArray)): ?>
						<img src="../modules/image.php?width=75&image=/images/awards/award_10000_Posts.png" align="center" title="Forum Ribbon: 10,000">
					<?php endif; ?>			
This is controlled by the public function here:

Code: Select all

    public function loadAward($id){
		global $Database, $Utilities;

		//Clean the username
		$awardID = $Utilities->clean($id, 'sql');
		return $Database->query_first("SELECT * FROM awards WHERE id = '$awardID'");
    }
So you are saying I could add the DESC at the end of the query in the public function above?

Like this?

Code: Select all

return $Database->query_first("SELECT * FROM awards WHERE id = '$awardID' DESC");

Re: Progession Awards

Posted: Tue Aug 19, 2014 8:59 am
by Tundrra
The DESC syntax is off a bit, you have to tell it which column you are sorting.

Code: Select all

SELECT * 
FROM awards 
WHERE id = '$award'
ORDER BY awards DESC

Re: Progession Awards

Posted: Tue Aug 19, 2014 9:33 am
by Tundrra
After re reading your if/then statement you might not need to change the query. I think the if/then statement should look for the highest number '28' first then check the lower ones. You want it to stop on the award with the most posts, so it should look for the highest first.

Re: Progession Awards

Posted: Tue Aug 19, 2014 10:28 am
by Lasarian
That's the problem, it's getting to that '9' and appears to stop there.