Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/05/2013, 12:06
Avatar de ChatDelMundo
ChatDelMundo
 
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 13 años, 5 meses
Puntos: 1
Arreglar función de cumpleaños

Tengo esta función, trabaja bien dando aviso dias antes del cumpleaños de los amigos agregados,

Pero el día que cumple años no se muestra el aviso.

Código PHP:
function friends_birthday() {
    global 
$client;
    
$m = date('n');
    
$d = date('j');
    
$next = $m+1;
    if (
$m<10) $m = '0'.$m;
    if (
$next > 12) $next = '01';
    if (
$d > 20) {
        
$nextm = " or (f.uid='{$client['id']}' and birthmonth='$next' and birthday<$d) ";
    }
    
$res = sql_query("select u.* from ".tb()."friends as f left join ".tb()."accounts as u on u.id=f.fid where (f.uid='{$client['id']}' and u.birthmonth='$m' and u.birthday>$d) $nextm  order by u.lastlogin desc limit 15");
    
$content = '<ul>';
    while (
$user = sql_fetch_array($res)) {
        
$total++;
        if (
$user['birthmonth'] < 10) $user['birthmonth'] = '0'.$user['birthmonth'];
        if (
$user['birthday'] < 10) $user['birthday'] = '0'.$user['birthday'];
        
$content .= '<li>'.url('u/'.$user['username'],$user['username']).' - <strong>'.$user['birthmonth'].'/'.$user['birthday'].'</strong></li>';
    }
    
$content .= '</ul>';
    if (!
$total) $content = 'none';
    return array(
'title'=>t('Friends birthday coming up'), 'content' => $content);
} 
__________________
► chatdelmundo.es