<--?php /* print " "; */ set_time_limit(0); // ignore php timeout $csv = array(); $c = 0; // 102 = 1yr badge. leave out. $bids = array(103,104,105,127,134,137,138,139); //debug //$bids = array(105,127); $sql ="SELECT ubb.bid as BadgeID, ubb.name as BadgeName, u.uid as UID, u.name as UserName, u.mail as Email FROM user_badges_user ubu JOIN user_badges_badges ubb on ubb.bid=ubu.bid JOIN users u on u.uid=ubu.uid WHERE ubu.bid in (" . implode(',', $bids) . ") AND ubu.uid in (SELECT distinct u.uid FROM users u join og_uid ou on ou.uid=u.uid join node n on n.nid=ou.nid join artistworks_groups_groups agg on agg.nid=ou.nid where u.uid>1 and n.type='school_page' and u.status=1 and (agg.integration = '' or agg.integration is null)) ORDER BY ubu.bid DESC, u.name "; //GROUP BY ubu.bid //ORDER BY ubu.bid"; $result = db_query($sql); //print ""; //print ""; $csv[$c++] = "Badge Name,Username,Firstname,Lastname,Email,Schools\n"; $seen = array(); $badgecount = 0; $grandbadgecount = 0; while ($row = db_fetch_object($result)) { if ($seen[$row->UID]) continue; $seen[$row->UID] = 1; $fnsql = "SELECT value from profile_values where fid=4 and uid=$row->UID"; $fnrow = db_fetch_object(db_query($fnsql)); $lnsql = "SELECT value from profile_values where fid=5 and uid=$row->UID"; $lnrow = db_fetch_object(db_query($lnsql)); $gsql = "SELECT artist_first_name, artist_last_name FROM users u join og_uid ou on ou.uid=u.uid join node n on n.nid=ou.nid join artistworks_groups_groups agg on agg.nid=ou.nid where u.uid=$row->UID and n.type='school_page' and (agg.integration = '' or agg.integration is null)"; $gresult = db_query($gsql); $groups = array(); while ($grow = db_fetch_object($gresult)) { //$groups[] = $grow->artist_first_name . ' ' . $grow->artist_last_name; $thisgroup = $grow->artist_first_name; if ($grow->artist_last_name && $grow->artist_last_name != '-') $thisgroup .= ' ' . $grow->artist_last_name; $groups[] = $thisgroup; } //$schools = implode('\n"; $badgecount = 0; //print "\n"; } $badgecount++; $grandbadgecount++; $lastBadgeName = $row->BadgeName; //print ""; //print ""; $csv[$c++] = "$row->BadgeName,$row->UserName,$fnrow->value,$lnrow->value,$row->Email,$schools\n"; } //print "\n"; //print "\n"; //print "\n"; //print "
Badge NameUsernameFirstnameLastnameEmailSchools
', $groups); $schools = implode(',', $groups); $BadgeName = ($row->BadgeName != $lastBadgeName) ? $row->BadgeName : ''; if ($BadgeName && $lastBadgeName) { //print "
Subtotal $lastBadgeName:$badgecount 
 
$BadgeName$row->UserName$fnrow->value$lnrow->value$row->Email$schools
$row->BadgeName$row->UserName$fnrow->value$lnrow->value$row->Email$schools
Subtotal $lastBadgeName:$badgecount 
 
GRAND TOTAL:$grandbadgecount 
"; header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename=badges_by_user.csv'); header('Pragma: no-cache'); print implode('', $csv); exit; ?>

Main menu

Menu
Close
Cart is Empty.

Affordable Plans

Each subscription is for a single school. Pricing and features can vary slightly per school.

$35
1 Month membership
renews monthly
Unlimited Access to Lessons
Unlimited Video Exchanges
Exclusive Content
Forums
$35/month (prepaid)
$90
3 Month membership
renews every 3 months
Unlimited Access to Lessons
Unlimited Video Exchanges
Exclusive Content
Forums
$30/month (prepaid)
$240
12 Month membership
renews every 12 months
Unlimited Access to Lessons
Unlimited Video Exchanges
Exclusive Content
Forums
$20/month (prepaid)
X