*LOTTERY TICKETS PM'D TO USERS*
This will add a link that allows your members to request a PM of their tickets before the drawing makes them disappear.
STEP ONE - Add a NEW PHRASE in your AdminCP:
Languages & Phrases -> Phrase Manager
- Select "Casino" from the dropdown
- Click "Add New Phrase"
Varname: casino_send_lottery_tickets
Text: PM Tickets To Me
STEP TWO - Open and edit the FILE lottery.php
Find:
Add below
(be sure to customize the adminpermission and host/sender settings!):
PHP Code:
function PMtickets($userid, $username, $title, $message)
{
global $vbulletin;
require_once('includes/class_dm.php');
require_once('includes/class_dm_pm.php');
$botpermissions['adminpermissions'] = 1; //your admin userid
$host['userid'] = 1; //userid PM is to be sent from
$host['username'] = "username"; //username PM is to be sent from
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_SILENT);
$pmdm->set('fromuserid', $host['userid']);
$pmdm->set('fromusername', $host['username']);
$pmdm->set_info('receipt', false);
$pmdm->set_info('savecopy', false);
$pmdm->set('title', $title);
$pmdm->set('message', $message);
$pmdm->set_recipients($username, $botpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->set_info('overridequota', true);
$pmdm->save();
}
Find:
PHP Code:
while ($ticket = $db->fetch_array($tickets))
{
$t = explode(",",$ticket['ticketnumbers']);
sort($t);
if($s == 1) $s = 2;
else $s = 1;
for ($i=0;$i<$numbers;$i++)
{
$y = $t[$i];
eval('$yourtickets .= "' . fetch_template('casino_lottery_yourtickets') . '";');
}
$y = NULL;
eval('$yourtickets .= "' . fetch_template('casino_lottery_yourtickets') . '";');
}
Replace with:
PHP Code:
$counter = 0;
$PMtext = "$username,\n\nHere are your Lottery Tickets for the next drawing:\n\n";
while ($ticket = $db->fetch_array($tickets))
{
$t = explode(",",$ticket['ticketnumbers']);
sort($t);
if($s == 1) $s = 2;
else $s = 1;
for ($i=0;$i<$numbers;$i++)
{
$y = $t[$i];
$PMnumbers .= $i == ($numbers-1) ? "[b]{$y}[/b]" : "[b]{$y}[/b]-";
eval('$yourtickets .= "' . fetch_template('casino_lottery_yourtickets') . '";');
}
$PMtext .= "Ticket ".($counter+1).": $PMnumbers\n";
$PMnumbers = "";
$y = NULL;
eval('$yourtickets .= "' . fetch_template('casino_lottery_yourtickets') . '";');
$counter++;
}
if ($counter > 0)
{
//send PM if requested
if ($_GET['private_message'] == "send")
{
$formatted_drawdate = preg_replace("/\<br\/\>/"," - ",$drawdate);
$PMtitle = "Lottery Tickets for $formatted_drawdate";
PMtickets($userid, $username, $PMtitle, $PMtext);
}
$alt = (fmod($counter,2) == 0) ? 1 : 2;
$yourtickets .= "
<td class='alt$alt' colspan='$i' align='center'><a href='casino.php?do=lottery&private_message=send'>$vbphrase[casino_send_lottery_tickets]</a></td>
";
}