From 3c364b84c6bfa1f553e1b4ecc34048d82c173929 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 14 Jan 2010 18:34:33 +0000 Subject: [PATCH] oops forgot to commit the getUserForSponsor function! --- common.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common.inc.php b/common.inc.php index 2a3d643..67b9102 100644 --- a/common.inc.php +++ b/common.inc.php @@ -1286,5 +1286,20 @@ function getTextFromHtml($html) { return $text; } +function getUserForSponsor($sponsor_id) { + // loop through each contact and draw a form with their data in it. + $q = mysql_query("SELECT *,MAX(year) FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id + WHERE + sponsors_id='" . $sponsor_id . "' + AND types LIKE '%sponsor%' + GROUP BY uid + HAVING deleted='no' + ORDER BY users_sponsor.primary DESC,lastname,firstname + LIMIT 1 + "); + $r=mysql_fetch_object($q); + return user_load_by_uid($r->uid); +} + ?>