PDA

View Full Version : New Thread on Calendar Event


Colin F
07-10-2004, 10:00 PM
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.

$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 ".$title.".
More information on this event is available on this page (.$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".vbdate("Y-n-j",TIMENOW,false,true,false,true)."&c=".$calendarid.).";
$iconid = 0;

$DB_site->query("INSERT INTO " . TABLE_PREFIX . "thread
(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
VALUES ('" . addslashes($threadtitle) . "', " . TIMENOW . ", $forumid, 1, 0, '$botusername', $botuserid, '$botusername', " . TIMENOW . ", $iconid, 1)
");
$threadid = $DB_site->insert_id();

$DB_site->query("INSERT INTO " . TABLE_PREFIX . "post
(threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible)
VALUES ($threadid, 0, '" . addslashes($threadtitle) . "', '$botusername', $botuserid, " . TIMENOW . ", '" . addslashes($postmessage) . "', 1, 0, 0, $iconid, 1)
");
$firstpostid = $DB_site->insert_id();

$DB_site->query("UPDATE " . TABLE_PREFIX . "thread
SET firstpostid = $firstpostid
WHERE threadid = $threadid
");

$DB_site->query("
UPDATE " . TABLE_PREFIX . "forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = " . TIMENOW . ",
lastposter = $botusername,
lastthread = '" . addslashes($threadtitle) . "',
lastthreadid = $threadid,
lasticonid = $iconid
WHERE forumid = $forumid
");

The variables to be edited (marked green) are:

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 if ($calendarinfo['neweventemail'])
Above that add the code you just edited.

Colin F
07-11-2004, 07:52 PM
Tips and Tricks

What's with the ugly US date format in the title?
If you want to change the date format in the title, just change the variable dateformat.
The european format is: d.m.Y (with leading zeros on day and month)
or j.n.Y (without leading zeros on day and month).
All the recognized characters in the date format can be found under http://www.php.net/date

It's all english! Where can I translate it? ORHow can I change the post text?
The whole posttext is saved in the postmessage variable. It can be translated, changed to your liking. New lines are achieved simply by having a new line in the code, no <br /> or \n\r. Also, smileys,bbcode,img tag as well as HTML can be used if you have these options enabled for the forum specified in forumid

I want all these event threads to have a special icon
Easy. Just edit the variable iconid to the iconid of the icon you wish to use.

Can I use the Event poster as the user that posts the thread?
Sure. Just change the 2 lines$botuserid = 1; //userid of poster
$botusername = "EventBot"; // username of posterto $botuserid = $bbuserinfo[userid]; //userid of poster
$botusername = $bbuserid[username]; // username of poster
Careful: these posts don't update the users post count.

Questions and Problems

The postcount of my bot/the user that is used to post threads hasn't changed!
It isn't supposed to. As the whole system is automated, I don't think they count as posts. Also, no one is interested in the postcount of a bot :)

FleaBag
07-12-2004, 12:25 AM
Just what I've been looking for - but is there a way to make the thread creator the user who adds the event to the calendar?

nexialys
07-12-2004, 12:44 AM
yeah i was to suggest this.. i don't know why you use a BOT... just put the author's ID would do better... i don't see why using a bot anyway, it's not an automated feature, the creation of the thread is asked by a user...

Andreas
07-12-2004, 12:52 AM
Just what I've been looking for - but is there a way to make the thread creator the user who adds the event to the calendar?

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()?


$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 ".$title.".
More information on this event is available on this page (.$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".date("Y-n-j")."&c=".$calendarid.).";
$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 :)

teksigns
07-12-2004, 12:56 AM
getting error

Database error in vBulletin 3.0.0:

Invalid SQL: INSERT INTO thread
(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
VALUES ('[] test event', 1089597260, 41, 1, 0, EventBot, 1364, EventBot, 1089597260, 0, 1)

mysql error: Unknown column 'EventBot' in 'field list'

mysql error number: 1054

Andreas
07-12-2004, 01:08 AM
getting error



$DB_site->query("INSERT INTO " . TABLE_PREFIX . "thread
(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
VALUES ('" . addslashes($threadtitle) . "', " . TIMENOW . ", $forumid, 1, 0, $botusername, $botuserid, $botusername, " . TIMENOW . ", $iconid, 1)
");


should be


$DB_site->query("INSERT INTO " . TABLE_PREFIX . "thread
(title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
VALUES ('" . addslashes($threadtitle) . "', " . TIMENOW . ", $forumid, 1, 0, '$botusername', $botuserid, '$botusername', " . TIMENOW . ", $iconid, 1)
");

And

$dateformat = "m-d-y";


should be before

$threadtitle =

alkatraz
07-12-2004, 01:43 AM
awesome hack! thank you

Colin F
07-12-2004, 09:34 AM
OK, looks like my small hack just got fully rewritten :) Thanks for the help KirbyDe!

I just did this the first way I saw how from looking at the code. I haven't tested it, but KirbyDe's Code would probably work just as well if anyone wants to use that.

nexialys
07-12-2004, 09:47 AM
maybe a little setting in the admincp, calendar section, where we can disable the feature, and select what forum to use, and maybe more options, like groups that can post...

i'm suggesting, maybe i will do that later anyway.

MrNase
07-12-2004, 04:44 PM
Could we make it so that we can select wether a new thread is started or not? Not every entry is worth a discussion :)

Colin F
07-12-2004, 05:25 PM
Could we make it so that we can select wether a new thread is started or not? Not every entry is worth a discussion :)

Sure. Just add a checkbox in the template with value=1, and put this at the beginning of the codeif ($_POST[checkboxname] == 1) {
and a } at the end of the code.

MrNase
07-13-2004, 12:34 PM
That's cool. Thank you :)


I will use it :)

snyx
07-14-2004, 06:34 AM
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()?


$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 ".$title.".
More information on this event is available on this page (.$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".date("Y-n-j")."&c=".$calendarid.).";
$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 don't like this automated message within the thread, is it possible it mimic the calendar post into the new thread?

Colin F
07-14-2004, 02:19 PM
Theoretically yes.

Try making $post[message] = $message;

DaveLogic
07-14-2004, 06:58 PM
Theoretically yes.

Try making $post[message] = $message;

This works with the main message content but would it be possible to say include a link (alike the original ) say Click here for full info which would rthen link back to the calendat???

Colin F
07-14-2004, 08:05 PM
Do you want the message content as well as a link back, or just part of the message content and a link saying something like [...more]?

The first could be done with something like

$post[message] = $message."
Click here for full info (.$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".date("Y-n-j")."&c=".$calendarid.)";

FleaBag
07-16-2004, 04:52 AM
Invalid SQL:
UPDATE forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = 1089956923,
lastposter = EventBot,
lastthread = '[07-12-04] hkhkhk',
lastthreadid = 12529,
lasticonid = 0
WHERE forumid = 47

mysql error: Unknown column 'EventBot' in 'field list'


Any idea what went wrong?

Colin F
07-24-2004, 07:46 AM
surround EventBot with 's
making it:
$DB_site->query("
UPDATE " . TABLE_PREFIX . "forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = " . TIMENOW . ",
lastposter = '$botusername',
lastthread = '" . addslashes($threadtitle) . "',
lastthreadid = $threadid,
lasticonid = $iconid
WHERE forumid = $forumid
");

obsidian
07-28-2004, 02:35 PM
I tried this out using Colins original hack and it comes up with a thread title that is one day off of the event. The "posted by" on the thread view is also blank. I ended up trying Kirby's code as well and the username shows up but the date is 1 day off as well.

Edit: After digging through the calendar.php file I assume this is because I am using a single all day event. If I do the ranged event it comes up correctly. I guess when it gets the single all day event it starts the previous day plus how ever many hours. Anyways anyone have an idea on a simple fix for it :)

PUPSTAHS
07-30-2004, 06:08 PM
I do the ranged event it comes up correctly. I guess when it gets the single all day event it starts the previous day plus how ever many hours. Anyways anyone have an idea on a simple fix for it :)
I'm having the same problem. Links to all day events always link to the day *before* the event starts, but ranged events work fine.

Anyone got a fix?

BTW great hack colin

PUPSTAHS
08-09-2004, 07:35 PM
So, is anyone working on a fix for the all-day-event bug mentioned above? It would be very much appreciated by at least several users.

Colin F
08-10-2004, 04:08 AM
I assume this is because of the timezone settings of some users. As I'm in GMT+1, I don't have any problems with this.

I'll have a look at it tonight though...

Colin F
08-10-2004, 07:08 PM
I've updated the first post with some info to (hopefully) fix the allday problem some users are having.

The changes are in the two calles to the function date(). These are now changed to vbdate() and some parameters were added.

SamirDarji
08-20-2004, 08:34 AM
This is exactly the type of hack I've been searching for. Well, all except one thing--I want the new thread to be displayed as part of the calendar event listing page. It doesn't sound too hard in theory, but you never know until you get into it. Thoughts anyone?

Lionel
10-30-2004, 11:22 PM
I am able to fix the problems on that one. Wish I could solve my problem with the other hack by the same author.

Torqued
11-10-2004, 03:16 PM
Theoretically yes.

Try making $post[message] = $message;


Actually.. I want both. :) I want the $message text as well as an automated message @ the bottom of the post.. so how do I modify the code below to put a couple of blank lines between the $message and the "This is an automatically generated blah blah blah"

$postmessage = $message."This is an automatically generated thread for the event ".$title.".
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].";

Colin F
11-10-2004, 03:24 PM
Actually.. I want both. :) I want the $message text as well as an automated message @ the bottom of the post.. so how do I modify the code below to put a couple of blank lines between the $message and the "This is an automatically generated blah blah blah"
Change this:
$postmessage = $message."This is an automatically generated thread for the event ".$title.".

to this:
$postmessage = $message."


This is an automatically generated thread for the event ".$title.".

Not sure if that works though.... you might also be able to use /n

Lionel
11-10-2004, 03:34 PM
I used \n to insert a blank line

obsidian
11-19-2004, 01:46 PM
Is there a way to move the forum jump dropdown into this and use it as a selection box for where to post the thread? Reason I ask is that I now have a couple calendars for different groups. I would like to be for the people to post their events on their private calendar and have this hack post the thread in their private forum.

benFF
11-24-2004, 12:00 AM
Is there anyway to make the calendar event link to the forum post about it, allowing users to discuss the calendar item easily?

Just also found the vb2 version of this hack, which actually allowed you to specify a forum and when a user went to start a new thread in it, it would automatically take them to the calendar input instead (which was then inserted into the forum as well as the calendar). This would be an awesome feature, as it would make sure people were entering events in the calendar and not just making a forum post....

SamirDarji
11-24-2004, 02:46 PM
Check out my calendar for a small change that allows me to put various event-related links. It's still a manual process as there is no way to keep a hard link between the thread and event listing. :(

nexialys
11-25-2004, 10:18 AM
it's easy to keep a link to the thread and event... but Colin F will have to update his code... not sure he will:

1- add a new field to events, adding the new threadid when new thread is created.
2- when thread is created, modify the event message by adding a new line with the thread url... (go to this url to read the thread XXX)
...

with that threadid in a field, you can do a lot of things..

Bison
12-11-2004, 01:40 PM
Nice idea, but it's quite confusing on how to do this. Could someone clean up these two hacks and make them easier to try?

Viks
12-31-2004, 01:18 AM
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

mysql error number: 1064

Date: Thursday 30th of December 2004 10:14:08 PM
Script: http://www.myforums.com/forums/calendar.php
Referer: http://www.myforums.com/forums/calendar.php?do=add&type=single&c=1
Username: A
IP Address: 64.1.2.3

============================================

please help.

thanks

vik

Viks
01-05-2005, 04:06 AM
Hi there, I was hoping to get some assistance on this. kindly help.

thanks

Vik

MikaK
01-06-2005, 08:26 AM
Is there anyway to make the calendar event link to the forum post about it, allowing users to discuss the calendar item easily?

Just also found the vb2 version of this hack, which actually allowed you to specify a forum and when a user went to start a new thread in it, it would automatically take them to the calendar input instead (which was then inserted into the forum as well as the calendar). This would be an awesome feature, as it would make sure people were entering events in the calendar and not just making a forum post....
Would be very cool! I have installed the "Colin F" version of this hack.
=Mika=

scottishcruise
01-23-2005, 05:44 PM
I am also getting the mysql error as posted by Viks, any help?? - the calendar event and thread seem to work fine but the error isn't nice to see when ppl are adding events :(

Viks
02-27-2005, 03:07 PM
no update on this one yet .. Colin?

CyberSlash69
03-01-2005, 02:04 AM
Was wondering if there is a hack, or a way that this can be switched around.. In PhpbbFM you post a thread, and in the thread you can edit the date you would like this to go to and it will automatically be added into the calendar.. Pretty much just the opposite of what it is now.. But it was much easier.

Crazy Serb
03-05-2005, 01:29 AM
Was wondering if there is a hack, or a way that this can be switched around.. In PhpbbFM you post a thread, and in the thread you can edit the date you would like this to go to and it will automatically be added into the calendar.. Pretty much just the opposite of what it is now.. But it was much easier.

yeah, that would be great too...


what i'm currently having a problem is that I've set up my forum in which the threads from the calendar are being posted as a moderated one - meaning, all new threads should be approved by mods, but since this script bypasses that check and directly inserts a new thread into the forum it's making my jump thru the hoops and checking all the threads/removing them manually every time someone posts something that should not have been approved in the first place.

So, is there any way the new threads can be created in that "moderation" queue or whatever the way the moderated threads are stored, and allow me to approve/delete them before they get posted. I can do that with the calendar events, but not the threads too.


And yeah, did anyone figure out how to link the thread # inside the event post as well? or even better, update the event post every time the matching thread is updated (the original post), or vice versa? that'd be great...

scratche
03-09-2005, 09:19 PM
Was wondering if there is a hack, or a way that this can be switched around.. In PhpbbFM you post a thread, and in the thread you can edit the date you would like this to go to and it will automatically be added into the calendar.. Pretty much just the opposite of what it is now.. But it was much easier.

im lookin for this same mod... is there anyway to use this one like that??? or is there somthing thats like this

scratche
03-23-2005, 03:54 AM
^^^^.....

YLP1
03-23-2005, 02:11 PM
Sure. Just add a checkbox in the template with value=1, and put this at the beginning of the codeif ($_POST[checkboxname] == 1) {
and a } at the end of the code.

Where does the above code go?

Thanks in advance.

tnguy3n
03-23-2005, 02:49 PM
i think it goes to the beginning and the ending of his hack.

Crazy Serb
04-02-2005, 10:06 PM
ok, just a question regarding starting new threads.

if i am inserting a new thread/post (from that calendar.php hack code that needs to be added) and if I want it to be moderated before going public, does that INSERT statement need to be changed to insert the new thread somewhere else, or is it being inserted into the same tables but with a different flag or something. How does the vbulletin know which threads need to be moderated and which don't? Where is that setting or where are those threads stored?

I'm just asking because I can't figure out how to moderate the new threads made with this script first, since it publishes the new thread right away, directly into the tables/database.

Crazy Serb
04-02-2005, 11:04 PM
^^

never mind, i got it from another hack...

if you want to have the thread being created from the calendar event to be moderated first, add this line of code:


$DB_site->query("REPLACE INTO " . TABLE_PREFIX . "moderation (threadid, postid, type) VALUES ($threadid, $firstpostid, 'thread')");


just before the last block of code:

$DB_site->query("
UPDATE " . TABLE_PREFIX . "forum ....

and change the "visible" value for the first two INSERT statements to zero (from "...$iconid, 1" to "...$iconid, 0" to make the threads invisible until approved)

YLP1
04-03-2005, 05:30 AM
I broke something but don't know what......I have about 40 events for the Month of April yet it says No events for the next 30 days... any ideas on how to fix this issue?

YLP1
04-14-2005, 02:13 PM
Newbie here...... Where would KirbeDEs code go and is his code in addition to Colin's?
The checkbox feature..which template does that get added to.

Sorry for my noobeness. Thanks in advance.

Torqued
04-14-2005, 04:08 PM
Is there a way to move the forum jump dropdown into this and use it as a selection box for where to post the thread? Reason I ask is that I now have a couple calendars for different groups. I would like to be for the people to post their events on their private calendar and have this hack post the thread in their private forum.

I would love to see this feature as well!!!!!

scratche
05-04-2005, 03:12 PM
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

Benj
05-05-2005, 09:06 AM
does this hack add calendar custom fields to the post as well ?

Torqued
05-11-2005, 12:10 AM
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:

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.

//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:

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.


//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:
<legend>$vbphrase[miscellaneous_options]</legend>

And add this below that code:
<div><input type="checkbox" name="makepost" value="1">Copy calendar event to new thread</div>

scratche
05-15-2005, 02:48 AM
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?

Cyricx
05-16-2005, 12:06 PM
That's awesome Torqued!! I can totally use that code to do exactly what I need with this :)

Thank you so much!!!

scratche
05-16-2005, 05:20 PM
how can i have the information from this hack
https://vborg.vbsupport.ru/showthread.php?t=63460&highlight=roll+call
post with the message in the thread????

Torqued
05-16-2005, 07:06 PM
That's awesome Torqued!! I can totally use that code to do exactly what I need with this :)

Thank you so much!!!

I'm sort of using it as a blog. You can see the results here: http://www.torqued.org/news

I'm glad someone else found it useful. :)

lionslair
05-21-2005, 05:50 AM
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()?


$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 ".$title.".
More information on this event is available on this page (.$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".date("Y-n-j")."&c=".$calendarid.).";
$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?

SamirDarji
05-26-2005, 03:17 AM
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.

HeloHi
05-26-2005, 11:56 PM
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

mysql error number: 1064

Date: Thursday 30th of December 2004 10:14:08 PM
Script: http://www.myforums.com/forums/calendar.php
Referer: http://www.myforums.com/forums/calendar.php?do=add&type=single&c=1
Username: A
IP Address: 64.1.2.3

============================================

please help.

thanks

vik

I am getting this error too. Anyone else run into this problem and figured out what is wrong with it?

Torqued
05-27-2005, 12:33 PM
I am getting this error too. Anyone else run into this problem and figured out what is wrong with it?

which version of the code did you install?

There are about 3 different versions in this thread. :cool:

HeloHi
05-28-2005, 01:36 AM
which version of the code did you install?

There are about 3 different versions in this thread. :cool:


I used Collin's original code, but modified to user usernames etc ect rather than bots. I also used the rolling 24 hour method rather than the midnight-midnight method. I will try KirbyDE's method and report back on how that works. I should have done that in the first place, I just got ahead of myself I guess when the error popped up hehe.

Edit: Tried Kirby's code and it doesn't create a thread. Is it just code to replace Collin's completely, or is it supposed to be added in somewhere? I am sorry for my noobness, but I really don't know alot about this stuff. I don't think I am the only one who had this problem though...

Newbie here...... Where would KirbeDEs code go and is his code in addition to Colin's?

I am going to integrate your checkbox hack as well, Torqued, whenever I can straighten this out. Maybe someone who has this working could just put the hacked code from their calander.php here?

mfarmerhi
05-31-2005, 09:35 AM
Beautiful, Colin. And big thanks to Torqued for compiling everything and printing exact instructions for adding the check box option (EXACTLY what I was looking for).

Installed.

*** Edited additional question***

Been testing it. Question: What does this hack do with re-occurring events? Still only initiate one thread (the very first time you post the event), then never again, despite the fact the event reoccurs?

Because the only one extra thing I'd REALLY want:

the ability to make this only post the new thread on the actual date of the event.

That is, say you have an event on July 4th. I'd like the hack to allow me to enter a calendar event for the 4th, and then *only when it get's to the 4th* post that event.

Re-occurring events would initiate a new thread every time the event reoccurred.

Any easy way to make it do that?

SamirDarji
05-31-2005, 02:17 PM
Been testing it. Question: What does this hack do with re-occurring events? Still only initiate one thread (the very first time you post the event), then never again, despite the fact the event reoccurs?

Because the only one extra thing I'd REALLY want:

the ability to make this only post the new thread on the actual date of the event.

That is, say you have an event on July 4th. I'd like the hack to allow me to enter a calendar event for the 4th, and then *only when it get's to the 4th* post that event.

Re-occurring events would initiate a new thread every time the event reoccurred.

Any easy way to make it do that?It's interesting that you bring up recurring events. A similar suggestion was posted for the Event Attendance hack. The problem is in how vb treats recurring events.

Recurring events seem to be the same as a regular event in the db, but with some sort of flag that allows it to show up multiple times. But with it actually being a single entry, everything associated with that event is stored only once including any hacks applied to the event listing. I don't really see any way to do it without having something to track the various dates of a recurring event or for recurring events to be re-designed so that they actually populate the calendar with multiple event listings that can be changed individually or as a whole.

Torqued
05-31-2005, 05:29 PM
It's interesting that you bring up recurring events. A similar suggestion was posted for the Event Attendance hack. The problem is in how vb treats recurring events.

Recurring events seem to be the same as a regular event in the db, but with some sort of flag that allows it to show up multiple times. But with it actually being a single entry, everything associated with that event is stored only once including any hacks applied to the event listing. I don't really see any way to do it without having something to track the various dates of a recurring event or for recurring events to be re-designed so that they actually populate the calendar with multiple event listings that can be changed individually or as a whole.

One way I can think of around that is to run a daily query/script that looks for events scheduled for that day and then have that process create new threads for those events.

SamirDarji
05-31-2005, 07:18 PM
One way I can think of around that is to run a daily query/script that looks for events scheduled for that day and then have that process create new threads for those events.Actually, what would be even better is a cron that looks at the recurring events list and then makes and event entry for a particular day if one isn't present. Then any hacks related to that particular entry would work fine. The only disadvantage is that once an event listing is created this way, changing the recurring event listing won't change the spawned event listing.

mfarmerhi
05-31-2005, 08:35 PM
Actually, what would be even better is a cron that looks at the recurring events list and then makes and event entry for a particular day if one isn't present. Then any hacks related to that particular entry would work fine. The only disadvantage is that once an event listing is created this way, changing the recurring event listing won't change the spawned event listing.
I am NOT educated in PHP, but isn't it possible to somehow just attach the date to event listings? I mean, that coding is already in there... can't the variable {event} be distinguished from the variable {event[today's_date]} ?

SamirDarji
05-31-2005, 10:54 PM
I am NOT educated in PHP, but isn't it possible to somehow just attach the date to event listings? I mean, that coding is already in there... can't the variable {event} be distinguished from the variable {event[today's_date]} ?Probably, but then what do you do for recurring events?

mfarmerhi
06-02-2005, 01:51 AM
Probably, but then what do you do for recurring events?Well, store that new variable, so that it's reoccurring event[5.30.05]; next months is event[6.30.05]... you can suddenly treat them (at least each of those variables) as separate events, although, for the sake of the rest of vB, they're treated as a single event.

The cron job actually sounds promising for both of the features I'd need -- actually starting the thread on the day it's scheduled (instead of simply when you enter the data on the calendar. I mean, if you're already typing in the info, why not just copy and paste it yourself into a new thread? As it stands, this hack isn't really saving you much but 2 or 3 extra mouse clicks...).

By treating each of the reoccurring events as a separate event (even if only as a separate data item) and using the cron jobs, it's open up a whole LOT of new possibilities for this hack...

SamirDarji
06-02-2005, 04:19 AM
Not a bad idea. I'm sure it would also help those of us that use the Event Attendance hack that are needing something for the recurring events.

Luciolle
06-21-2005, 01:40 PM
Ok sorry I bump this old message but I try to install on vbulletin 3.0.7, I know it's for vb 3.0.3 but it'S supposed to work, but I have always the same error as some people before on this subjet:

Error:

Database error in vBulletin 3.0.7:

Invalid SQL:
UPDATE forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = 1119364576,
lastposter = FrancoisEVENBOT,
lastthread = '[d-m-y] TEST 2435425252523 !!!',
lastthreadid = 119,
lasticonid = 0
WHERE forumid = 63

mysql error: Unknown column 'FrancoisEVENBOT' in 'field list'

mysql error number: 1054

Some body have a solution for that ?
Thanks

(P.S.: I read all messages and I don't find solution or I'm not looking so great ^^)

Colin F
06-21-2005, 02:47 PM
Ok sorry I bump this old message but I try to install on vbulletin 3.0.7, I know it's for vb 3.0.3 but it'S supposed to work, but I have always the same error as some people before on this subjet:

Error:

Database error in vBulletin 3.0.7:

Invalid SQL:
UPDATE forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = 1119364576,
lastposter = FrancoisEVENBOT,
lastthread = '[d-m-y] TEST 2435425252523 !!!',
lastthreadid = 119,
lasticonid = 0
WHERE forumid = 63

mysql error: Unknown column 'FrancoisEVENBOT' in 'field list'

mysql error number: 1054

Some body have a solution for that ?
Thanks

(P.S.: I read all messages and I don't find solution or I'm not looking so great ^^)
See this post: https://vborg.vbsupport.ru/showpost.php?p=531727&postcount=7

YLP1
07-18-2005, 06:04 PM
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:

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.

//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:

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.


//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:
<legend>$vbphrase[miscellaneous_options]</legend>

And add this below that code:
<div><input type="checkbox" name="makepost" value="1">Copy calendar event to new thread</div>

I am so confused... I have three instances of this code: require_once('./includes/functions_databuild.php');

which one do I put the last piece of code above?

jugo
07-27-2005, 02:41 PM
can someone port this to vb3.5.

djsydeburnz
09-24-2005, 04:11 AM
quick question. lets say that i would prefer to have my title list as 'Event, Date, Location' and I have my 'location' listed as a custom field in my database. I know that in the database, the custom id #4 is for location. I can figure out everything but the location in posting it to the title of the forum.

$post[title] = .$title"|".vbdate($dateformat, $dateline_from,false,true,false,true)."|" ?unknown code;

shoud give me:

Event Title | Event Date | Event Location

djsydeburnz
09-24-2005, 04:30 AM
oh, and also wanted to repost an earlier request about listing the information from the roll call feature. in case the rollcall feature is unknown, it is another hack where users can 'mark their attendance' to the event. in the calendar, it lists the members who have marked their attendance, and it would be cool to post this info at the bottom of the thread, just like in the calendar.

thanks in advance.

tendo
02-02-2006, 04:40 PM
Does this work for 3.5 at all? Seattle Dnb really needs this. I think it's stupid that vBulletin doesnt have this built in.

Thanks for your time.

Ashiro
02-20-2006, 05:10 PM
I'm recieving the error:

Call to a member function on a non-object in /home/ashiro/public_html/degenerates/board2/calendar.php on line 1944

Is there any chance you could help me out? I'd like to get this mod working as it'd be very useful. Thank you.

Alphawolf83
12-12-2007, 07:18 AM
Is there a product for vb3.6.x? :) I did search, but didnt find anything...

conradk
10-21-2008, 01:52 AM
Anybody running this mode with 3.7.3? Checking before I start hacking.

Videx
10-21-2008, 02:11 AM
No, this has been superseded by https://vborg.vbsupport.ru/showthread.php?t=123416 which is running good in 3.7.3.

XrayHead
11-24-2008, 07:27 PM
Hi All

Anyone know if there is a newer version of this hack or if this works with 3.7?

I'm just upgrading from SMF and this is a standard feature with their software. As itÂ’s a club site we use this ALL the time to link events in the Calendar to threads in the forum!!

Lee

Videx
11-24-2008, 07:51 PM
What's wrong with the one I just linked to?

XrayHead
11-24-2008, 08:06 PM
OPP's Sorry........ :erm:

Trying to multi task to much I think!!