I would like to know how to syn birthday from calendar to forum?
If you're talking about a hack that makes threads for birthdays, this one won't do it, but there is one out there that does. I ran into it once but forgot the name.
If you're talking about a hack that makes threads for birthdays, this one won't do it, but there is one out there that does. I ran into it once but forgot the name.
This change will ensure all occurrences of the word 'thread' on the page are changed to 'event'... eg, 'print thread' becomes 'print event'. (NOTE: This does not take translations into account)
It also fixes a display error where the event details come before the action / admin / inline mod bar (it should come after, not before).
Open the plugin called "Display Event Details on Thread Page - BBR" (showthread complete hook)... replace all with this:-
Code:
// we need to initialise this variable here, otherwise on non Event Threads, the var will show as text
$lv_vb_eventforums_eventdetails = "";
// is this a VB event forum?
$lv_vb_eventforums_eventForum = false;
$lv_vb_eventforums_map = preg_split('/[\n:]/', trim($vbulletin->options['lv_vb_eventforums_map']));
for($lv_vb_eventforums_i = 0; $lv_vb_eventforums_i<count($lv_vb_eventforums_map); $lv_vb_eventforums_i+=2)
{
if(intval($lv_vb_eventforums_map[$lv_vb_eventforums_i+1]) == $foruminfo['forumid'])
{
$lv_vb_eventforums_eventForum = true;
break;
}
}
$lv_vb_eventforums_eventid = $threadinfo['lv_vb_eventforums_eventid'];
if($lv_vb_eventforums_eventForum && ($lv_vb_eventforums_eventid > 0) && (!empty($lv_vb_eventforums_eventid)))
{
require_once(DIR . '/includes/functions_calendar.php');
require_once(DIR . '/includes/functions_misc.php');
require_once(DIR . '/includes/functions_newpost.php');
require_once(DIR . '/includes/functions.php');
require_once(DIR . '/includes/functions_user.php');
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true);
// get the event
$lv_vb_eventforums_event = $vbulletin->db->query_read("
SELECT *, IF(dateline_to = 0, 1, 0) AS singleday
FROM " . TABLE_PREFIX . "event
WHERE eventid = " . intval($lv_vb_eventforums_eventid) . "
");
$lv_vb_eventforums_event = $vbulletin->db->fetch_array($lv_vb_eventforums_event);
$eventinfo = $lv_vb_eventforums_event;
### Added by Farcaster #############################################################################
$offset = $eventinfo['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset'];
$eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
$eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;
####################################################################################################
// get the user info
$lv_vb_eventforums_user = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE userid = " . intval($eventinfo['userid']) . "
");
$lv_vb_eventforums_user = $vbulletin->db->fetch_array($lv_vb_eventforums_user);
// get the calendar info
$lv_vb_eventforums_calendar = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "calendar
WHERE calendarid = " . intval($eventinfo['calendarid']) . "
");
$lv_vb_eventforums_calendar = $vbulletin->db->fetch_array($lv_vb_eventforums_calendar);
$calendarinfo = $lv_vb_eventforums_calendar;
$calendarinfo['title'] = '<a href="calendar.php?c=' . $eventinfo['calendarid'] . '">' . $calendarinfo['title'] . '</a>';
// work out offsets etc
$offset = $lv_vb_eventforums_event['utc'] ? $vbulletin->userinfo['timezoneoffset'] : ($vbulletin->userinfo['timezoneoffset'] ? $vbulletin->userinfo['tzoffset'] : $vbulletin->userinfo['timezoneoffset']);
$from = $eventinfo['dateline_from'] + $offset * 3600;
$to = $eventinfo['dateline_to'] + $offset * 3600;
if($lv_vb_eventforums_event['dateline_to'] == 0)
{
$from = $lv_vb_eventforums_event['dateline_from'];
}
$date1 = trim(vbdate($vbulletin->options['dateformat'], $from, false, true, false, true));
$date2 = trim(vbdate($vbulletin->options['dateformat'], $to, false, true, false, true));
$time1 = trim(vbdate($vbulletin->options['timeformat'], $from, false, true, false, true));
$time2 = trim(vbdate($vbulletin->options['timeformat'], $to, false, true, false, true));
// phrases
require_once(DIR . '/includes/functions_databuild.php'); // added by Farcaster
fetch_phrase_group("calendar"); // added by Farcaster
$vbphrase['date_x_to_y'] = fetch_phrase("date_x_to_y", 'calendar');
$vbphrase['time_x_to_y'] = fetch_phrase("time_x_to_y", 'calendar');
$vbphrase['delete_reminder_for_this_event'] = fetch_phrase("delete_reminder_for_this_event", 'calendar');
$vbphrase['request_reminder_for_this_event'] = fetch_phrase("request_reminder_for_this_event", 'calendar');
$vbphrase['event_options'] = fetch_phrase("event_options", 'calendar');
$vbphrase['edit_event'] = fetch_phrase("edit_event", 'calendar');
$vbphrase['delete_event'] = fetch_phrase("delete_event", 'calendar');
$vbphrase['move_event'] = fetch_phrase("move_event", 'calendar');
$vbphrase['event_uses_dst'] = fetch_phrase("event_uses_dst", 'calendar');
$vbphrase['event_posted_for_timezone_x'] = fetch_phrase("event_posted_for_timezone_x", 'calendar');
$vbphrase['lv_vb_eventforums_phrase_noReplies'] = fetch_phrase("lv_vb_eventforums_phrase_noReplies", 'calendar');
// Initialise all the variables we need to set for the template
$show['canmoveevent'] = false;
$show['caneditevent'] = false;
$show['candeleteevent'] = false;
$show['postedby'] = true;
$show['subscribed'] = false;
$show['subscribelink'] = true;
$show['recuroption'] = false;
$show['adjustedday'] = false;
$show['holiday'] = false;
$show['singleday'] = false;
$show['daterange'] = false;
$show['customfields'] = false;
$show['customoption'] = false;
$show['eventoptions'] = false;
// can the user move or delete this event?
$show['canmoveevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'canmoveevents');
$show['candeleteevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'candeleteevents');
$show['caneditevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'caneditevents');
if(isset($lv_vb_eventforums_permissions))
{
// check each usergroup
foreach($lv_vb_eventforums_permissions as $key => $value)
{
// can this user edit the event?
if(!$show['caneditevent'])
{
if($eventinfo['userid'] == $vbulletin->userinfo['userid'])
{
if(($value & $vbulletin->bf_ugp_calendarpermissions['caneditevent']))
{
$show['caneditevent'] = true;
}
}
}
}
}
// show the options box?
if(($show['candeleteevent'] OR $show['canmoveevent'] OR $show['caneditevent']) AND !$show['holiday'])
{
$show['eventoptions'] = true;
}
fetch_musername($eventinfo);
// construct the user info for the event poster
$eventinfo['username'] = $lv_vb_eventforums_user['username'];
// user title
$eventinfo['usertitle'] = $lv_vb_eventforums_user['usertitle'];
if($usertitle != '')
{
$eventinfo['usertitle'] .= '<div class="smallfont" style="margin-bottom:3px;">' . $usertitle . '</div>';
}
//we already have the avatar info, no need to refetch.
fetch_avatar_from_userinfo($eventinfo);
// prepare the member action drop-down menu
$memberaction_dropdown = construct_memberaction_dropdown($eventinfo);
//$avatar = fetch_avatar_url($eventinfo['userid']);
//$eventinfo['avatarurl'] = $avatar[0];
// does the current user have a reminder for this event?
if($lv_vb_eventforums_eventReminderRows != 0)
{
$show['subscribed'] = true;
}
if($eventinfo['dateline_to'] == 0)
{
$show['singleday'] = true;
}
if(strcmp($date1, $date2) != 0)
{
$show['daterange'] = true;
}
if(!$show['daterange'] || $show['singleday'])
{
$eventdate = $date1;
}
$eventinfo['event'] = $bbcode_parser->parse($eventinfo['event'], $foruminfo['forumid'], true);
if ($vbulletin->options['bbr_image_active']) {
$eventid = $eventinfo['eventid'];
$eventinfo['event'] = preg_replace('/<img src="([^"]*)" border="0" alt="" \/>/', '<a href="\\1" rel="' . $vbulletin->options['bbr_image_type'] . '[' . $eventid . ']"><img src="\\1" style="max-width: ' . $vbulletin->options['bbr_image_width'] . 'px; max-height: ' . $vbulletin->options['bbr_image_height'] . 'px; cursor: pointer;" border="0" alt="" /></a>', $eventinfo['event']);
}
$templater = vB_Template::create('spacer_open');
$spacertable1 = $templater->render();
$templater = vB_Template::create('spacer_close');
$spacertable2 = $templater->render();
($hook = vBulletinHook::fetch_hook('calendar_getday_event')) ? eval($hook) : false; // Added by Farcaster
$templater = vB_Template::create('calendar_showeventsbit');
$templater->register('calendarinfo', $calendarinfo);
$templater->register('customfields', $customfields);
$templater->register('date1', $date1);
$templater->register('date2', $date2);
$templater->register('eventdate', $eventdate);
$templater->register('eventinfo', $eventinfo);
$templater->register('gobutton', $gobutton);
$templater->register('memberaction_dropdown', $memberaction_dropdown);
$templater->register('recurcriteria', $recurcriteria);
$templater->register('spacer_close', $spacer_close);
$templater->register('spacer_open', $spacer_open);
$templater->register('time1', $time1);
$templater->register('time2', $time2);
$lv_vb_eventforums_eventblock = $templater->render();
if($vbulletin->options['lv_vb_eventforums_varForEventDetails'])
{
$lv_vb_eventforums_eventdetails = $lv_vb_eventforums_eventblock;
}
else
{
$postbits = $lv_vb_eventforums_eventblock . $postbits;
}
// if thread is only showing first post, and is an event thread
if($totalposts == 1) // only first post
{
$templater = vB_Template::create('lv_vb_eventforums_noPostSpacer');
$noposts = $templater->render();
$postbits = $postbits . $noposts;
} // is first post
$vbphrase = str_replace('Thread', 'Event', $vbphrase);
$vbphrase = str_replace('thread', 'event', $vbphrase);
}
This change will ensure all occurrences of the word 'thread' on the page are changed to 'event'... eg, 'print thread' becomes 'print event'. (NOTE: This does not take translations into account)
It also fixes a display error where the event details come before the action / admin / inline mod bar (it should come after, not before).
Open the plugin called "Display Event Details on Thread Page - BBR" (showthread complete hook)... replace all with this:-
Code:
// we need to initialise this variable here, otherwise on non Event Threads, the var will show as text
$lv_vb_eventforums_eventdetails = "";
// is this a VB event forum?
$lv_vb_eventforums_eventForum = false;
$lv_vb_eventforums_map = preg_split('/[\n:]/', trim($vbulletin->options['lv_vb_eventforums_map']));
for($lv_vb_eventforums_i = 0; $lv_vb_eventforums_i<count($lv_vb_eventforums_map); $lv_vb_eventforums_i+=2)
{
if(intval($lv_vb_eventforums_map[$lv_vb_eventforums_i+1]) == $foruminfo['forumid'])
{
$lv_vb_eventforums_eventForum = true;
break;
}
}
$lv_vb_eventforums_eventid = $threadinfo['lv_vb_eventforums_eventid'];
if($lv_vb_eventforums_eventForum && ($lv_vb_eventforums_eventid > 0) && (!empty($lv_vb_eventforums_eventid)))
{
require_once(DIR . '/includes/functions_calendar.php');
require_once(DIR . '/includes/functions_misc.php');
require_once(DIR . '/includes/functions_newpost.php');
require_once(DIR . '/includes/functions.php');
require_once(DIR . '/includes/functions_user.php');
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true);
// get the event
$lv_vb_eventforums_event = $vbulletin->db->query_read("
SELECT *, IF(dateline_to = 0, 1, 0) AS singleday
FROM " . TABLE_PREFIX . "event
WHERE eventid = " . intval($lv_vb_eventforums_eventid) . "
");
$lv_vb_eventforums_event = $vbulletin->db->fetch_array($lv_vb_eventforums_event);
$eventinfo = $lv_vb_eventforums_event;
### Added by Farcaster #############################################################################
$offset = $eventinfo['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset'];
$eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
$eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;
####################################################################################################
// get the user info
$lv_vb_eventforums_user = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE userid = " . intval($eventinfo['userid']) . "
");
$lv_vb_eventforums_user = $vbulletin->db->fetch_array($lv_vb_eventforums_user);
// get the calendar info
$lv_vb_eventforums_calendar = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "calendar
WHERE calendarid = " . intval($eventinfo['calendarid']) . "
");
$lv_vb_eventforums_calendar = $vbulletin->db->fetch_array($lv_vb_eventforums_calendar);
$calendarinfo = $lv_vb_eventforums_calendar;
$calendarinfo['title'] = '<a href="calendar.php?c=' . $eventinfo['calendarid'] . '">' . $calendarinfo['title'] . '</a>';
// work out offsets etc
$offset = $lv_vb_eventforums_event['utc'] ? $vbulletin->userinfo['timezoneoffset'] : ($vbulletin->userinfo['timezoneoffset'] ? $vbulletin->userinfo['tzoffset'] : $vbulletin->userinfo['timezoneoffset']);
$from = $eventinfo['dateline_from'] + $offset * 3600;
$to = $eventinfo['dateline_to'] + $offset * 3600;
if($lv_vb_eventforums_event['dateline_to'] == 0)
{
$from = $lv_vb_eventforums_event['dateline_from'];
}
$date1 = trim(vbdate($vbulletin->options['dateformat'], $from, false, true, false, true));
$date2 = trim(vbdate($vbulletin->options['dateformat'], $to, false, true, false, true));
$time1 = trim(vbdate($vbulletin->options['timeformat'], $from, false, true, false, true));
$time2 = trim(vbdate($vbulletin->options['timeformat'], $to, false, true, false, true));
// phrases
require_once(DIR . '/includes/functions_databuild.php'); // added by Farcaster
fetch_phrase_group("calendar"); // added by Farcaster
$vbphrase['date_x_to_y'] = fetch_phrase("date_x_to_y", 'calendar');
$vbphrase['time_x_to_y'] = fetch_phrase("time_x_to_y", 'calendar');
$vbphrase['delete_reminder_for_this_event'] = fetch_phrase("delete_reminder_for_this_event", 'calendar');
$vbphrase['request_reminder_for_this_event'] = fetch_phrase("request_reminder_for_this_event", 'calendar');
$vbphrase['event_options'] = fetch_phrase("event_options", 'calendar');
$vbphrase['edit_event'] = fetch_phrase("edit_event", 'calendar');
$vbphrase['delete_event'] = fetch_phrase("delete_event", 'calendar');
$vbphrase['move_event'] = fetch_phrase("move_event", 'calendar');
$vbphrase['event_uses_dst'] = fetch_phrase("event_uses_dst", 'calendar');
$vbphrase['event_posted_for_timezone_x'] = fetch_phrase("event_posted_for_timezone_x", 'calendar');
$vbphrase['lv_vb_eventforums_phrase_noReplies'] = fetch_phrase("lv_vb_eventforums_phrase_noReplies", 'calendar');
// Initialise all the variables we need to set for the template
$show['canmoveevent'] = false;
$show['caneditevent'] = false;
$show['candeleteevent'] = false;
$show['postedby'] = true;
$show['subscribed'] = false;
$show['subscribelink'] = true;
$show['recuroption'] = false;
$show['adjustedday'] = false;
$show['holiday'] = false;
$show['singleday'] = false;
$show['daterange'] = false;
$show['customfields'] = false;
$show['customoption'] = false;
$show['eventoptions'] = false;
// can the user move or delete this event?
$show['canmoveevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'canmoveevents');
$show['candeleteevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'candeleteevents');
$show['caneditevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'caneditevents');
if(isset($lv_vb_eventforums_permissions))
{
// check each usergroup
foreach($lv_vb_eventforums_permissions as $key => $value)
{
// can this user edit the event?
if(!$show['caneditevent'])
{
if($eventinfo['userid'] == $vbulletin->userinfo['userid'])
{
if(($value & $vbulletin->bf_ugp_calendarpermissions['caneditevent']))
{
$show['caneditevent'] = true;
}
}
}
}
}
// show the options box?
if(($show['candeleteevent'] OR $show['canmoveevent'] OR $show['caneditevent']) AND !$show['holiday'])
{
$show['eventoptions'] = true;
}
fetch_musername($eventinfo);
// construct the user info for the event poster
$eventinfo['username'] = $lv_vb_eventforums_user['username'];
// user title
$eventinfo['usertitle'] = $lv_vb_eventforums_user['usertitle'];
if($usertitle != '')
{
$eventinfo['usertitle'] .= '<div class="smallfont" style="margin-bottom:3px;">' . $usertitle . '</div>';
}
//we already have the avatar info, no need to refetch.
fetch_avatar_from_userinfo($eventinfo);
// prepare the member action drop-down menu
$memberaction_dropdown = construct_memberaction_dropdown($eventinfo);
//$avatar = fetch_avatar_url($eventinfo['userid']);
//$eventinfo['avatarurl'] = $avatar[0];
// does the current user have a reminder for this event?
if($lv_vb_eventforums_eventReminderRows != 0)
{
$show['subscribed'] = true;
}
if($eventinfo['dateline_to'] == 0)
{
$show['singleday'] = true;
}
if(strcmp($date1, $date2) != 0)
{
$show['daterange'] = true;
}
if(!$show['daterange'] || $show['singleday'])
{
$eventdate = $date1;
}
$eventinfo['event'] = $bbcode_parser->parse($eventinfo['event'], $foruminfo['forumid'], true);
if ($vbulletin->options['bbr_image_active']) {
$eventid = $eventinfo['eventid'];
$eventinfo['event'] = preg_replace('/<img src="([^"]*)" border="0" alt="" \/>/', '<a href="\\1" rel="' . $vbulletin->options['bbr_image_type'] . '[' . $eventid . ']"><img src="\\1" style="max-width: ' . $vbulletin->options['bbr_image_width'] . 'px; max-height: ' . $vbulletin->options['bbr_image_height'] . 'px; cursor: pointer;" border="0" alt="" /></a>', $eventinfo['event']);
}
$templater = vB_Template::create('spacer_open');
$spacertable1 = $templater->render();
$templater = vB_Template::create('spacer_close');
$spacertable2 = $templater->render();
($hook = vBulletinHook::fetch_hook('calendar_getday_event')) ? eval($hook) : false; // Added by Farcaster
$templater = vB_Template::create('calendar_showeventsbit');
$templater->register('calendarinfo', $calendarinfo);
$templater->register('customfields', $customfields);
$templater->register('date1', $date1);
$templater->register('date2', $date2);
$templater->register('eventdate', $eventdate);
$templater->register('eventinfo', $eventinfo);
$templater->register('gobutton', $gobutton);
$templater->register('memberaction_dropdown', $memberaction_dropdown);
$templater->register('recurcriteria', $recurcriteria);
$templater->register('spacer_close', $spacer_close);
$templater->register('spacer_open', $spacer_open);
$templater->register('time1', $time1);
$templater->register('time2', $time2);
$lv_vb_eventforums_eventblock = $templater->render();
if($vbulletin->options['lv_vb_eventforums_varForEventDetails'])
{
$lv_vb_eventforums_eventdetails = $lv_vb_eventforums_eventblock;
}
else
{
$postbits = $lv_vb_eventforums_eventblock . $postbits;
}
// if thread is only showing first post, and is an event thread
if($totalposts == 1) // only first post
{
$templater = vB_Template::create('lv_vb_eventforums_noPostSpacer');
$noposts = $templater->render();
$postbits = $postbits . $noposts;
} // is first post
$vbphrase = str_replace('Thread', 'Event', $vbphrase);
$vbphrase = str_replace('thread', 'event', $vbphrase);
}
Ok, I am not sure if this mod is to blame, but I am now receiving a new "vBulletin Database Error!".
When a new calendar event is created, the mod creates a new thread in a forum, as the mod is designed to do. However, the forum is moderated and new threads require approval.
When a new event is created, I receive two emails. The first is the error email (see below). And the second is the new thread notification, which is normal. Here is the error:
PHP Code:
Database error in vBulletin 4.0.1:
Invalid SQL:
DELETE FROM vb_moderation
WHERE type = 'thread'
AND threadid = 43476;
MySQL Error : Unknown column 'threadid' in 'where clause'
Error Number : 1054
Request Date : Thursday, February 11th 2010 @ 12:21:57 AM
Error Date : Thursday, February 11th 2010 @ 12:21:57 AM
Script : http://www.allbowling.com/forum/calendar.php?do=update&e=
Referrer : http://www.allbowling.com/forum/calendar.php?do=add&type=single&c=1
IP Address : [userip]
Username : [username]
Classname : vB_Database
MySQL Version :
Does anyone have this mod installed where the target forum requires moderation? Can anyone duplicate this?
Thanks in advance!
Has this been solved? I need the threads to be moderated before hand so I can't just switch it off.