Resultados 1 al 2 de 2

Ayuda con hack, que envie Notificacion solo si se crea tema

Esta es una discusión en el tema Ayuda con hack, que envie Notificacion solo si se crea tema dentro del foro Soporte de programación, parte de la categoría Programación avanzada y trabajos Freelance; 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 ...

  1. #1
    Usuario
    Fecha de ingreso
    29/mar/2010
    Edad
    31
    Mensajes
    22
    Gracias
    3
    Agradecido 0 veces en 0 mensajes
    Poder de Credibilidad
    0

    Predeterminado Ayuda con hack, que envie Notificacion solo si se crea tema

    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:
    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$messagetrue$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'$vbulletinERRTYPE_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;
    }

    ?>
    Tambien probe poniendo:
    IF ($post['postid'] == $thread['firstpostid'])



    Temas Similares:
    Última edición por felixthekat; 30/11/2010 a las 19:58

  2. #2
    Administrador Avatar de Jhonnyf
    Fecha de ingreso
    13/jun/2009
    Ubicación
    In my mind
    Mensajes
    1.363
    Gracias
    60
    Agradecido 1.104 veces en 565 mensajes
    Entradas de Blog
    1
    Poder de Credibilidad
    10

    Predeterminado Respuesta: Ayuda con hack

    aparentemente la logica en tu codigo es la correcta, pero ahi solo se evita enviar un MP, más arriba está el envio de correo

    Código PHP:
    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$messagetrue$from $frommail$uheaders ''$username '');
                    }
                }
                
     
                
                            

            } 


    [GRACIAS] -> es Boton magico que hace que siempre recibas soporte, USALO!!!

Etiquetas de este tema

Foro | Chat y Juegos | Hello Kitty | Programacion | Foro Cristiano | XAT | Chat Foro | Perú | SummArg