MyBB Community Forums
[For 1.8] OUGC Awards - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Releases (https://community.mybb.com/forum-102.html)
+---- Thread: [For 1.8] OUGC Awards (/thread-116640.html)

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


RE: OUGC Awards 1.0.7 - crazy4cs - 2012-09-19

Sure, I'll aid you if I find any fix for quick reply. I guess I'm okay with running one query in PMs.


RE: OUGC Awards 1.0.7 - crazy4cs - 2012-09-20

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.


RE: OUGC Awards 1.0.7 - Omar G. - 2012-09-21

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.


RE: OUGC Awards 1.0.7 - Verilog - 2012-10-07

Was testing this plugin out,it doesn't show on postbit.


RE: OUGC Awards 1.0.7 - Omar G. - 2012-10-09

Make sure the required variable is in your postbit template. ({$pos['ougc_awards']} IIRC)


RE: OUGC Awards 1.0.7 - crazy4cs - 2012-10-09

(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.


RE: OUGC Awards 1.0.7 - Uzinero - 2012-10-15

Thanks for this Smile Been looking for a good alternative to the paid plugin


RE: OUGC Awards 1.0.7 - 7uyk - 2012-10-17

(Nothing personal)

Do you think this is more stable than MyAwards?
I like this ones' features more, buy myawards is basically 100% stable.


RE: OUGC Awards 1.0.7 - Omar G. - 2012-10-18

I'm not sure what to answer, really. I have never used MyAwards and don't know if it is frequently updated.


RE: OUGC Awards 1.0.7 - 7uyk - 2012-10-18

It's not frequently updated, there's nothing wrong with it.

Like, do you plan on finding more bugs and errors?