prepare(“update wp_mysl_alertEmails set activityHash = %s, dateLastDeActivationRequest = %s where id = %d”,
$hash,
date(‘Y-m-d H:i:s’),
$var[‘subID’]);

if($wpdb->query($qry))
{
$totalDeactivate++;

$emailBody = $emailBody.’

‘.$var[‘divisionName’].’ -> ‘.$var[‘teamName’];

}
}
}

if($totalDeactivate > 0)
{
$emailBody=$emailBody.’

To finalize this deactivation, please CLICK HERE.’;

$headers = ‘From: myslwebmaster@michigansoccer.com’ . “rn” .
‘Reply-To: myslwebmaster@michigansoccer.com’ . “rn” .
‘MIME-Version: 1.0’ . “rn” .
‘Content-Type: text/html; charset=ISO-8859-1′ . “rn”;

mail($_POST[email],’MYSL Email Subscription Deactivation’,$emailBody,$headers);

echo(“

We have flagged your desired deactivations, and a confirmation message has been sent to your email address

In the message, you will find a link that must be clicked on to complete the subscription deactivation.

“);
}

}

if($_GET[deactivate])
{
$qry = $wpdb->prepare(“Update wp_mysl_alertEmails set active = 0, dateLastDeActivated = %s where emailAddress = %s and activityHash = %s”,
date(‘Y-m-d H:i:s’),
$_GET[email],
$_GET[deactivate]);

if($wpdb->query($qry))
{
echo(“

Subscriptions successfully deactivated.

“);
}
}

if( isset($_GET[email]) || isset($_POST[email]) )
{
$emailAddress = $_GET[email] ?: $_POST[email];

$qry = $wpdb->prepare(“SELECT distinct LL.title as ‘Division’,LT.title as ‘teamName’,LT.id as ‘teamID’,MAE.active, MAE.id as ‘subID’ FROM wp_mysl_alertEmails MAE join 4Ao_leaguemanager_teams LT on MAE.teamID = LT.id join 4Ao_leaguemanager_leagues LL on LT.league_id = LL.id Where LT.season=’Fall 2012′ and MAE.active = 1 and MAE.emailAddress = ‘%s’ order by LL.title, LT.title”,
$emailAddress);

$subscriptions = $wpdb->get_results($qry);

if($subscriptions)
{
?>

Below, you will find a table of all of the active alert subscriptions for email address:

If you wish to deactivate any of your subscriptions, click the checkbox in the “Deactivate?” column. Once you’ve checked all subscriptions you wish to deactivate click “Deactivate Now!”

Deactivate? Division Team Name

Please enter the email address whose notification subscriptions you’d like to manage.