Buenas, espero que por favor me puedan ayudar.
He instalado un hack el cual seguis a los usuarios, cuando los usuarios crean un tema o lo responden, se les informa a los seguidores mediante email y mp.
La cuestion es que yo solo quiero que haga esto cuando el usuario crea un tema, no cuando lo responden. pero no se que condicion ponerle, probe con
Probe poniendo:
if ($threadfirstpostid == $postid)
pero no funcione
Este es el codigo completo:
Tambien probe poniendo:Código PHP:<?php
function notifyfollowers($userid = 0, $threadtitle = '', $threadid = 0, $postid = 0, $followers = '', $notifydateline = 0, $threadfirstpostid = 0){
global $vbulletin;
($hook = vBulletinHook::fetch_hook('subscribetouser_function_notifyfollowers_start')) ? eval($hook) : false;
$arrayfollowers = explode('|', $followers);
$number_rows = count($arrayfollowers);
if ($number_rows > 0){
$bbtitle = $vbulletin->options['bbtitle'];
$homeurl = $vbulletin->options['homeurl'];
$forumurl = $vbulletin->options['bburl'];
$hometitle = $vbulletin->options['hometitle'];
$frommail = $vbulletin->options[subscribetouser_email_sender];
$frommail = str_replace("{2}","$bbtitle",$frommail);
$userinfo = fetch_userinfo($userid);
$subject = $vbulletin->options[subscribetouser_email_subject];
$subject = str_replace("{1}","$userinfo[username]",$subject);
$subject = str_replace("{2}","$bbtitle",$subject);
$message = $vbulletin->options[subscribetouser_email_body];
$message = str_replace("{1}","$userinfo[username]",$message);
$message = str_replace("{2}","$bbtitle",$message);
$message = str_replace("{3}","$threadtitle ",$message);
$message = str_replace("{4}","$forumurl/showthread.php?t=$threadid&p=$postid",$message);
foreach ($arrayfollowers AS $follower){
$followerinfo = fetch_userinfo($follower);
$uheaders = '';
if ( $followerinfo AND !in_array($followerinfo['usergroupid'], explode("|", $vbulletin->options['subscribetouser_usergroup_off']))){
$toemail = $followerinfo[email];
$tousername = $followerinfo[username];
$uheaders .= "To: $username <$toemail>" . "\r\n";
$uheaders .= "From: " . $frommail . " <" . $vbulletin->options['webmasteremail'] . ">" . "\r\n";
if(is_valid_email($toemail)){
vbmail($toemail, $subject, $message, true, $from = $frommail, $uheaders = '', $username = '');
}
}
}
$subscribetouser_pmpermissions['adminpermissions'] = 2; // Override a potentially full inbox.
if ($threadfirstpostid == $postid){
// create the DM to do error checking and insert the new PM
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', 1);
$pmdm->set('fromusername', 'Notificacion');
$pmdm->set('title', $frommail);
$pmdm->set('message', $message);
$pmdm->set_recipients($tousername,$subscribetouser_pmpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->save(); }
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET `notifydateline` = '$notifydateline'
WHERE userid = $userid
");
}
($hook = vBulletinHook::fetch_hook('subscribetouser_function_notifyfollowers_end')) ? eval($hook) : false;
return true;
}
?>
IF ($post['postid'] == $thread['firstpostid'])
Temas Similares:


LinkBack URL
About LinkBacks

Responder Citando