| 1 |
<?php |
<?php |
| 2 |
// $Id: affiliates.module,v 1.1.4.5.2.13 2009/03/02 16:18:05 paulbooker Exp $ |
// $Id: affiliates.module,v 1.1.4.5.2.14 2009/04/07 16:46:25 paulbooker Exp $ |
| 3 |
|
|
| 4 |
// Portions Copyright 2006 http://2bits.com |
// Portions Copyright 2006 http://2bits.com |
| 5 |
define ('AFFILIATE_BUTTONS_DIRECTORY_RELATIVE_FILES', '/affiliates'); |
define ('AFFILIATE_BUTTONS_DIRECTORY_RELATIVE_FILES', '/affiliates'); |
| 913 |
switch ($op) { |
switch ($op) { |
| 914 |
case 'view': |
case 'view': |
| 915 |
$items = array(); |
$items = array(); |
| 916 |
|
$points = db_result(db_query("SELECT SUM(aa.points) AS points |
| 917 |
if ($user->uid != $account->uid) { |
FROM {affiliates} a, {affiliates_ads} aa |
| 918 |
// someone else viewing their points |
WHERE aa.ad_id = a.ad_id |
| 919 |
$points = db_result(db_query("SELECT SUM(aa.points) AS points |
AND a.user_id = %d", $account->uid)); |
| 920 |
FROM {affiliates} a, {affiliates_ads} aa |
$affiliates[] = array( |
| 921 |
WHERE aa.ad_id = a.ad_id |
'#type' => 'user_profile_item', |
| 922 |
AND a.user_id = %d", $account->uid)); |
'#title' => t('Affiliate points'), |
| 923 |
|
'#value' => $account->name . " has earned " . number_format($points) . " points." |
| 924 |
$items[] = array( |
); |
| 925 |
'title' => t('Affiliate points'), |
if ($affiliates) { |
| 926 |
'value' => $account->name . " has earned " . number_format($points) . " points.", |
$affiliates['#type'] = 'user_profile_category'; |
| 927 |
); |
$affiliates['#title'] = t('Affiliates'); |
| 928 |
} |
$affiliates['#weight'] = 8; |
| 929 |
return array(t('Affiliate') => $items); |
$account->content['Affiliates'] = $affiliates; |
| 930 |
|
} |
| 931 |
} |
} |
| 932 |
} |
} |
| 933 |
|
|