Seite 1 von 1

Nach Update auf 3.0.6: Fatal error: Call to undefined method

Verfasst: 26.11.2009 12:00
von IceD
Fatal error: Call to undefined method user::format_dateucb() in includes\functions_upcbirthdays.php on line 87

Code: Alles auswählen

                        $birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<span title="' . $user->format_dateucb(($ucbirthdayrow[$i]['user_birthday_tstamp']), 'D, j. M') . '">' . $user_link . '</span>';
was kann da dazwischen funken? im Gegensatz zu den anderen Updates lief es ansonsten reibunglos, scheinbar jedenfalls.

Re: Nach Update auf 3.0.6: Fatal error: Call to undefined method

Verfasst: 26.11.2009 17:16
von nickvergessen
Hast du eine MOD eingebaut, die zukünftige Geburtstage anzeigt?

Re: Nach Update auf 3.0.6: Fatal error: Call to undefined method

Verfasst: 26.11.2009 18:17
von IceD
jup, hab ich. Wobei ich abgesehen von den language Dateien und den nicht problematischen Konflikten, den neuen Code genommen habe.

Edit: habs, man merkt, dass ich mich schon ne Weile damit nicht mehr beschäftigt habe :roll:

Re: Nach Update auf 3.0.6: Fatal error: Call to undefined method

Verfasst: 27.11.2009 10:35
von Helmut
Hallo IceD,

also bei mir läuft der Upcoming Birthday list Mod von lefty74 ohne Probleme mit 3.0.6. Die von dir genannte Codezeile sieht bei mir allerdings etwas anders aus. Hier mal die Funktion:

Code: Alles auswählen

function get_upcbirthdays()
{
   global $cache, $config, $db, $user, $auth;
   global $template, $phpbb_root_path, $phpEx;
      
   $birthday_ahead_list = '';
   $sql = 'SELECT user_id, username, user_colour, user_birthday
      FROM ' . USERS_TABLE . "
      WHERE user_birthday NOT LIKE '%- 0-%'
         AND user_birthday NOT LIKE '0-%'
            AND   user_birthday NOT LIKE '0- 0-%'
               AND   user_birthday NOT LIKE ''
                  AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
                  ORDER BY username';
   //BEGIN for those of you who have the prime birthday mod installed, code provided by primehalo
   $prime_birthdate_installed = function_exists('user_show_congrats');
    if ($prime_birthdate_installed)
    {
        $sql = str_replace('FROM ' . USERS_TABLE, ', user_show_age FROM ' . USERS_TABLE, $sql);
    }   
   //END for those of you who have the prime birthday mod installed, code provided by primehalo
   $result = $db->sql_query($sql);
   //delete the above line and uncomment below line if you want to cache the query for an hour
   //$result = $db->sql_query($sql,3600);

   $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
    $today = (mktime(0, 0, 0, $now['mon'], $now['mday'], $now['year']));
   
   $ucbirthdayrow = array();
   while ($row = $db->sql_fetchrow($result))
   {
       $birthdaycheck = strtotime(gmdate('Y') . '-' . (int) trim(substr($row['user_birthday'],3,-5)) . '-' . (int) trim(substr($row['user_birthday'],0,-8) ));
      $birthdayyear = ( $birthdaycheck < $today ) ? gmdate('Y') + 1 : gmdate('Y');
      $birthdaydate = ($birthdayyear . '-' . (int) trim(substr($row['user_birthday'],3,-5)) . '-' . (int) trim(substr($row['user_birthday'],0,-8) ));
      $ucbirthdayrow[] = array(
                     'username'            =>   $row['username'],
                     'user_birthday_tstamp'    => strtotime($birthdaydate),
                     'user_birthdayyear'    => $birthdayyear,
                     'user_birthday'       =>    $row['user_birthday'],
                     'user_id'            =>   $row['user_id'],
                     'user_show_age'         =>   (isset($row['user_show_age'])) ? $row['user_show_age'] : 0,
                     'user_colour'         =>   $row['user_colour']);
   }
   $db->sql_freeresult($result);
   //sort($ucbirthdayrow);

   for ($i = 0, $end = sizeof($ucbirthdayrow); $i < $end; $i ++)
   {
      if ( $ucbirthdayrow[$i]['user_birthday_tstamp'] >= ($today + 86400) && $ucbirthdayrow[$i]['user_birthday_tstamp'] <= ($today + ((($config['allow_birthdays_ahead'] >365) ? 365 : $config['allow_birthdays_ahead']) * 86400) ) )
      {
         // BEGIN for those of you who have the prime birthday mod installed, code provided by primehalo
         if ($prime_birthdate_installed)
         {
            if (!user_show_congrats($ucbirthdayrow[$i]['user_show_age']))
            {
               continue;
            }
            $ucbirthdayrow[$i]['user_birthday_tstamp'] = (user_show_age($ucbirthdayrow[$i]['user_show_age'])) ? $ucbirthdayrow[$i]['user_birthday_tstamp'] : '';
         }   
         // END for those of you who have the prime birthday mod installed, code provided by primehalo
         
         // Thanks to nickvergessen for the code suggestion
         $user_link = get_username_string('full', $ucbirthdayrow[$i]['user_id'], $ucbirthdayrow[$i]['username'], $ucbirthdayrow[$i]['user_colour']);

         //lets add to the birthday_ahead list.
         $birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<span title="' . $user->format_dateucb(($ucbirthdayrow[$i]['user_birthday_tstamp']), 'D, j. M h') . '">' . $user_link . '</span>';
         if ( $age = (int) substr($ucbirthdayrow[$i]['user_birthday'], -4) )
         {
            $birthday_ahead_list .= ' (' . ($ucbirthdayrow[$i]['user_birthdayyear'] - $age) . ')';
         }
      }
   }
   
   // Assign index specific vars
   $template->assign_vars(array(
      'BIRTHDAYS_AHEAD_LIST'   => $birthday_ahead_list,
      'L_BIRTHDAYS_AHEAD'   => sprintf($user->lang['BIRTHDAYS_AHEAD'], ($config['allow_birthdays_ahead'] >365) ? 365 : $config['allow_birthdays_ahead']),
      ));
} 
 
Schaue mal, ob es bei dir in der sessions.php nicht durch das Update an Problemen mit der Codeänderung vom Mod gegeben hat.

Gruß Helmut