PDA

View Full Version : Birthdays = Array?


ElfenLied1337
07-11-2010, 02:55 PM
Hi,

I'm currently running vB 3.7.3. On the bottom of my forum index, birthdays show up as "Array" instead of listing the birthdays of the forum members. Looks like this:

https://vborg.vbsupport.ru/external/2010/07/30.png

Below is my site's birthday.php

$tdate = vbdate('Y-m-d', TIMENOW, false, false);

if (!is_array($vbulletin->birthdaycache) OR ($tdate != $vbulletin->birthdaycache['day1'] AND $tdate != $vbulletin->birthdaycache['day2']))
{
include_once('./includes/functions_databuild.php');
$vbulletin->birthdaycache = build_birthdays();
}
switch($tdate)
{
case $vbulletin->birthdaycache['day1']:
$birthdays =& $vbulletin->birthdaycache['users1'];
break;

case $vbulletin->birthdaycache['day2'];
$birthdays =& $vbulletin->birthdaycache['users2'];
break;
}
$show['tablerow'] = true;

$birthdays_str = '';
// Birthdays change from a string to array in vB 3.7 RC3
if (is_array($birthdays))
{
if (empty($birthdays))
{
$birthdays_str = $vbphrase['none'];
}
else
{
foreach ($birthdays AS $birthkey => $birthinfo)
{
$birthdays_str .= '<a href="' . $vbulletin->options['bburl'] . '/member.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $birthinfo['userid'] . '">' . $birthinfo['username'] . '</a>' . iif($birthinfo['age'], ' (' . $birthinfo['age'] . ')') . '<br />';
}
}
}
else if ($birthdays)
{
$birthdays_str = str_replace(array('member.php', ','), array($vbulletin->options['bburl'] . '/member.php', '<br />'), $birthdays);
}
else
{
$birthdays_str = $vbphrase['none'];
}

($hook = vBulletinHook::fetch_hook('vba_cmps_module_birthda ys')) ? eval($hook) : false;

$home[$mods['modid']]['content'] = $birthdays_str;


How can I make it so it lists the birthdays instead of it displaying "Array" for each day? Any help is appreciated... thanks.

BirdOPrey5
07-11-2010, 05:45 PM
The only place I have birthday.php is in my includes/cron folder and it looks nothing like your birthday.php file- is this from some sort of mod?

ElfenLied1337
07-11-2010, 06:52 PM
Sorry about that, I posted the wrong one.



// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################

$today = date('m-d', TIMENOW);

$ids = '0';
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'] AND !in_array($usergroup['usergroupid'], array(1, 3, 4)))
{
$ids .= ",$usergroupid";
}
}

$birthdays = $vbulletin->db->query_read("
SELECT username, email, languageid
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$today-%' AND
(options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ") AND
usergroupid IN ($ids)
");

vbmail_start();

while ($userinfo = $vbulletin->db->fetch_array($birthdays))
{
$username = unhtmlspecialchars($userinfo['username']);
eval(fetch_email_phrases('birthday', $userinfo['languageid']));
vbmail($userinfo['email'], $subject, $message);
$emails .= iif($emails, ', ');
$emails .= $userinfo['username'];
}

vbmail_end();

if ($emails)
{
log_cron_action($emails, $nextitem, 1);
}

BirdOPrey5
07-11-2010, 07:59 PM
My file is identical except the first if statement for me is:

if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'] AND $usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] AND !in_array($usergroup['usergroupid'], array(1, 3, 4)))


But that's for 3.7.7 so I don't know if it will work for 3.7.3.

ElfenLied1337
07-12-2010, 12:09 AM
I tried changing the first if-statement with the one you had and reuploading it, but the birthdays are still showing up as "Array" on the forum index.

BirdOPrey5
07-12-2010, 12:49 AM
did you run the birthday scheduled task manually after making the change?

snakes1100
07-12-2010, 03:25 PM
Did you verify that you forumhome & forumhome_birthdaybit templates are correct and not missing any closing </if> statements?

Backup your forumhome & forumhome_birthdaybit templates and then revert them.

Guest190829
07-14-2010, 05:06 AM
If you are looking at the forum index, you should be looking at index.php and I don't think the snippet you provided is from there - it looks like cron file to send out emails.

Marco van Herwaarden
07-14-2010, 05:32 AM
Make sure your index.php is the default file for the version you are using.