MyBB Community Forums

Full Version: OUGC Awards
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Sure, I'll aid you if I find any fix for quick reply. I guess I'm okay with running one query in PMs.
Found anything? Actually I've got my schedule busy and appointments all these weekend.

I've some time tomorrow, I shall utilize and try to find a fix for postbit. I'd let you know if I find a fix.
The problem is that the $pids variable is only avaible at showthread.php. No sure how you are running your queries but for me this seems to work:
		// First we need to get our data
		if(THIS_SCRIPT == 'private.php')
		{
			global $db, $pm;

			$query = $db->query("
				SELECT a.aid, a.name, a.image, pm.uid
				FROM ".TABLE_PREFIX."ougc_awards a
				JOIN ".TABLE_PREFIX."ougc_awards_users ag ON (ag.aid=a.aid)
				JOIN ".TABLE_PREFIX."privatemessages pm ON (pm.uid=ag.uid)
				WHERE pm.pmid='{$pm['pmid']}' AND a.visible='1' AND a.type!='1'
				ORDER BY ag.date desc
				".($max_postbit == -1 ? '' : 'LIMIT '.$max_postbit)."
			");
		
			while($data = $db->fetch_array($query))
			{
				$ougc_awards_cache[$data['uid']][$data['aid']] = $data;
			}
			$awards = $ougc_awards_cache[$pm['uid']];
		}
		elseif(THIS_SCRIPT == 'announcements.php')
		{
			global $db, $aid;

			$query = $db->query("
				SELECT a.aid, a.name, a.image, ann.uid
				FROM ".TABLE_PREFIX."ougc_awards a
				JOIN ".TABLE_PREFIX."ougc_awards_users ag ON (ag.aid=a.aid)
				JOIN ".TABLE_PREFIX."announcements ann ON (ann.uid=ag.uid)
				WHERE ann.aid='{$aid}' AND a.visible='1' AND a.type!='1'
				ORDER BY ag.date desc
				".($max_postbit == -1 ? '' : 'LIMIT '.$max_postbit)."
			");

			while($data = $db->fetch_array($query))
			{
				$ougc_awards_cache[$data['uid']][$data['aid']] = $data;
			}
			$awards = $ougc_awards_cache[$pm['uid']];
		}
		elseif(THIS_SCRIPT == 'showthread.php')
		{
			static $ougc_awards_cache = null;
			if(!isset($ougc_awards_cache))
			{
				global $db, $pids;

				$query = $db->query("
					SELECT a.aid, a.name, a.image, p.uid
					FROM ".TABLE_PREFIX."ougc_awards a
					JOIN ".TABLE_PREFIX."ougc_awards_users ag ON (ag.aid=a.aid)
					JOIN ".TABLE_PREFIX."posts p ON (p.uid=ag.uid)
					WHERE p.{$pids} AND a.visible='1' AND a.type!='1'
					ORDER BY ag.date desc
					-- ".($max_postbit == -1 ? '' : 'LIMIT '.$max_postbit)
				);
			
				while($data = $db->fetch_array($query))
				{
					$ougc_awards_cache[$data['uid']][$data['aid']] = $data;
				}
			}
			$awards = $ougc_awards_cache[$post['uid']];
		}
		else
		{
			global $db, $mybb;

			$query = $db->query("
				SELECT a.aid, a.name, a.image, ag.uid
				FROM ".TABLE_PREFIX."ougc_awards a
				JOIN ".TABLE_PREFIX."ougc_awards_users ag ON (ag.aid=a.aid)
				WHERE ag.uid='{$mybb->user['uid']}' AND a.visible='1' AND a.type!='1'
				ORDER BY ag.date desc
				".($max_postbit == -1 ? '' : 'LIMIT '.$max_postbit)
			);
		
			while($givedawards = $db->fetch_array($query))
			{
				$ougc_awards_cache[$givedawards['uid']][$givedawards['aid']] = $givedawards;
			}
			$awards = $ougc_awards_cache[$mybb->user['uid']];
		}

The else statement is for:
newreply.php
newthread.php
showthread.php (quick reply only)
editpost.php

Though editpost.php requires a different way to get the post author UID.
Was testing this plugin out,it doesn't show on postbit.
Make sure the required variable is in your postbit template. ({$pos['ougc_awards']} IIRC)
(2012-10-07, 05:25 AM)Verilog Wrote: [ -> ]Was testing this plugin out,it doesn't show on postbit.
Also check if number of awards to be shown on postbit is set to a value higher than zero.
Thanks for this Smile Been looking for a good alternative to the paid plugin
(Nothing personal)

Do you think this is more stable than MyAwards?
I like this ones' features more, buy myawards is basically 100% stable.
I'm not sure what to answer, really. I have never used MyAwards and don't know if it is frequently updated.
It's not frequently updated, there's nothing wrong with it.

Like, do you plan on finding more bugs and errors?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49