Version: 1.00, by Colin F
Developer Last Online: Apr 2014
Version: 3.0.3
Rating:
Released: 07-10-2004
Last Update: Never
Installs: 19
Re-useable Code Translations Is in Beta Stage
No support by the author.
New Thread on Calendar Event
What it does:
This rather small hack is easy: it starts a new thread in a specific forum for every Event that is posted in the calendar. On our forum it is used for discussion of partys (as it's a party calendar).
Is it complicated?
There is actually very little to change, but in that small part, there are a lot of variables to be edited which are forum specific. That might make it a bit hard for php newlings
Changes: New files (0):
none
Changed files(1):
calendar.php
New database fields/tables(0):
none
New templates(0):
none
Changed templates(0):
none
New phrases(0):
none
Screenshots:
No visible changes
Instructions:
Backup all your forum files as well as your database
Copy the following code into your favorite PHP editing program (Dreamweaver, Wordpad, Notepad...) and edit it to fit your forums.
PHP Code:
$forumid = 1; // forumid in which to post
$botuserid = 1; //userid of poster
$botusername = "EventBot"; // username of poster
$dateformat = "m-d-y";
$threadtitle = "[".vbdate($dateformat, $dateline_from,false,true,false,true)."] ".$title;
$postmessage = "This is an automatically generated thread for the event [b]".$title."[/b].
More information on this event is available on [url=".$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".vbdate("Y-n-j",TIMENOW,false,true,false,true)."&c=".$calendarid."]this page[/url].";
$iconid = 0;
forumid is the forumid of the forum in which the Bot will be posting the threads to the calendar events
botuserid is the userid of the user that will be shown as the author of the thread. I suggest making a special user and naming him something like EventBot
botusername is the username of the user that will be shown as the author of the thread. Should be the username to the userid indicated in botuserid. Make sure the username is enclosed in quotation marks ("").
Open your calendar.php and look for
PHP Code:
if ($calendarinfo['neweventemail'])
Above that add the code you just edited.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
hi there i wanted to know if ne one could help.. im using the roll call feature for my calendar... and i want it too post that in my forum aswell for each thread can anyone assist me in doin this
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;
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;
hi there i wanted to know if ne one could help.. im using the roll call feature for my calendar... and i want it too post that in my forum aswell for each thread can anyone assist me in doin this
can anyone help me with this i can seem to get the roll call options to post aswell into the thread that this hack creates... any suggestions?
Instead of $botuserid and $botusername use $bbuserinfo[userid] and $bbuserinfo[username].
And I wonder why this hack re-invents the wheel instead of just using build_new_post()?
PHP Code:
$forumid = 1; // forumid in which to post
// Get forum info
$foruminfo = fetch_foruminfo($forumid, false);
// Prepare the thread ...
$post[title] = "[".date($dateformat, $dateline_from)."] ".$title;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[message] = "This is an automatically generated thread for the event [b]".$title."[/b].
More information on this event is available on [url=".$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".date("Y-n-j")."&c=".$calendarid."]this page[/url].";
$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);
If you want to be fully flexible, one could make the text as a phrase, forum ID and date format string as a setting
I have public and private events and if the event is public I want it to be posted into the public forum. If it is a private event I want it to be posted into the proivate forum. Is this able to be done?
I have public and private events and if the event is public I want it to be posted into the public forum. If it is a private event I want it to be posted into the proivate forum. Is this able to be done?
It is possible to be done, but will add to the complexity of this hack as the destination forum has to vary with the source calendar. So some code will have to be put in that checks what calendar the event is being posted to, to determine the destination forum for the thread. I'm no coder, but it's a bit of work from the current implementation.
hi guys, Colin,
I am getting the follwing error message when i add a new calender event.
Once I go back to my forum i see the thread and the event but the error message occurs each time a new event is added.
Error message==
===============
Database error in vBulletin 3.0.3:
Invalid SQL:
UPDATE forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = 1104462847,
lastposter = ,
lastthread = '[12-30-04] new event',
lastthreadid = 62,
lasticonid = 0
WHERE forumid = 18
mysql error: You have an error in your SQL syntax near '
lastthread = '[12-30-04] new event',
lastthreadid = 62,
lasticonid = 0
WHER' at line 6