Ok. Here is what I did to enable a check box. This will add a check box to the Miscellaneous Options when you are creating or editing a calendar event.
When creating a new event:
1: Checking the check box will copy the event as a new thread in $forumid (defined in the code).
2: Leaving the check box unchecked will only create the event on the calendar.
When editing an existing event:
1: Checking the check box will copy the event as a new thread in $forumid (defined in the code).
2: Leaving the check box unchecked will only update the calendar entry.
Now... if you already created a thread and go edit the event later and check the check box, it does not update the previous thread - it creates a new thread.
Also, if you want to convert an existing event to a new thread, you do not really have to "edit" anything. Just click on edit event, check the check box, and save. This will create the new thread in your forum.
In calendar.php, find the following code:
PHP Code:
if ($calendarinfo['neweventemail'])
And add this code
above that. Be sure you edit the $forumid to be the forum you want posts to show up in.
PHP Code:
//hack New Thread on Calendar Event
if ($_POST[makepost] == 1) {
//add check box functionality
$forumid = 1; // forumid in which to post
// Get forum info
$foruminfo = fetch_foruminfo($forumid, false);
$dateformat = "d M, Y";
$threadtitle = "[".vbdate($dateformat, $dateline_from,false,true,false,true)."] ".$title;
// Prepare the thread ...
$post[title] = $threadtitle;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[message] = $message;
$post[username] = $bbuserinfo[userid];
$post[iconid] = 0;
$post[emailupdate] = 9999;
// ... and create it
require_once('./includes/functions_newpost.php');
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
//add check box functionality
}
//hack New Thread on Calendar Event
Still in calendar.php, find this code:
PHP Code:
require_once('./includes/functions_databuild.php');
And add this code
above it. Be sure you edit the $forumid to be the forum you want posts to show up in.
PHP Code:
//hack New Thread on Calendar Event
if ($_POST[makepost] == 1) {
//add check box functionality
$forumid = 1; // forumid in which to post
// Get forum info
$foruminfo = fetch_foruminfo($forumid, false);
$dateformat = "d M, Y";
$threadtitle = "[".vbdate($dateformat, $dateline_from,false,true,false,true)."] ".$title;
// Prepare the thread ...
$post[title] = $threadtitle;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[message] = $message;
$post[username] = $bbuserinfo[userid];
$post[iconid] = 0;
$post[emailupdate] = 9999;
// ... and create it
require_once('./includes/functions_newpost.php');
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
//add check box functionality
}
//hack New Thread on Calendar Event
Adding the check box:
Log into your AdminCP and go to the Style Manager.
Open the
calendar_edit template and find this code:
Code:
<legend>$vbphrase[miscellaneous_options]</legend>
And add this
below that code:
Code:
<div><input type="checkbox" name="makepost" value="1">Copy calendar event to new thread</div>